﻿using SRB.Tg.DrawingStandard;
using SRB.Tg.Operate;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Teigha.DatabaseServices;
using Teigha.Geometry;

namespace SRB.Tg.Model
{
    public class PierRebarOld
    {
        PierPara pierPara;
        //string strDiameter = "%%130";
        string strDiameter = "A";
        List<double> spanBeamLst = new List<double>(); //盖梁部分钢筋分布
        List<double> spancwLst = new List<double>();  //横桥向截面分布
        List<double> spanclLst = new List<double>();  //顺桥向截面分布
        List<double> spanPileCapLst = new List<double>(); //承台部分钢筋分布

        List<double> spancsLst = new List<double>();
        List<double> spancaLst = new List<double>();
        List<double> spancmLst = new List<double>();

        List<double> spancmlLst = new List<double>();
        List<double> spancslLst = new List<double>();

        int BulkheadCount = 2;
        double FH = 0;
        double MH = 0;
        double BH = 0;
        double MHB = 0;

        double topThickness = 0;
        double bottomThickness = 0;

        double radius = 2;

        public PierRebarOld(PierPara para)
        {
            pierPara = para;
            switch (para.pierRebarOld.reinforcement_grade)
            {
                //case "HRB300":
                //    strDiameter = "%%130";
                //    break;
                //case "HRB335":
                //    strDiameter = "%%131";
                //    break;
                //case "HRB400":
                //    strDiameter = "%%132";
                //    break;
                //case "HRB500":
                //    strDiameter = "%%133";
                //    break;
                //default:
                //    strDiameter = "%%130";
                //    break;
                case "HRB300":
                    strDiameter = "A";
                    break;
                case "HRB335":
                    strDiameter = "B";
                    break;
                case "HRB400":
                    strDiameter = "C";
                    break;
                case "HRB500":
                    strDiameter = "D";
                    break;
                default:
                    strDiameter = "A";
                    break;
            }


            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[0]);
            double tw = double.Parse(sizeT[1]);
            double mH = double.Parse(sizeM[0]);
            double mw = double.Parse(sizeM[1]);
            double bH = double.Parse(sizeBulk[0]);
            double bw = double.Parse(sizeBulk[1]);
            double bwL = double.Parse(sizeBulkL[1]);
            int thickness = pierPara.column.top_thickness;
            topThickness = double.Parse(thickness.ToString());
            bottomThickness = double.Parse(thickness.ToString());
            FH = topH + tH + pierPara.pierRebarOld.top_encryption_spacing * 25.5;
            MH = pierPara.pierRebarOld.middle_encryption_spacing * 20 + mH * 2 + bH;
            if (BulkheadCount == 1)
                MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            else if (BulkheadCount == 2)
                MH = pierPara.pierRebarOld.middle_encryption_spacing * 20 + mH * 2 + bH;
            else
                MH = pierPara.pierRebarOld.middle_encryption_spacing * 15 + mH * 2 + bH;
            BH = botH + tH + pierPara.pierRebarOld.bottom_encryption_spacing * 15;
            #region 钢筋分布

            #region 盖梁钢筋分布
            string beamLayout = pierPara.pierRebarOld.beam_penstration_layout;
            string[] span = beamLayout.Split('+');


            for (int i = 0; i < span.Length; i++)
            {
                if (span[i].Contains("*"))
                {
                    string[] sp = span[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spanBeamLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(span[i]) > 0)
                    {
                        spanBeamLst.Add(double.Parse(span[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spanBeamLst.Add(0);
                    }
                }
            }
            #endregion

            #region 横桥向主筋分布
            string csLayout = pierPara.pierRebarOld.main_w_thickness_layout;
            string[] spancs = csLayout.Split('+');


            for (int i = 0; i < spancs.Length; i++)
            {
                if (spancs[i].Contains("*"))
                {
                    string[] sp = spancs[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spancsLst.Add(v);
                        spancwLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(spancs[i]) > 0)
                    {
                        spancsLst.Add(double.Parse(spancs[i]));
                        spancwLst.Add(double.Parse(spancs[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spancsLst.Add(0);
                    }
                }
            }

            string caLayout = pierPara.pierRebarOld.main_w_angle_layout;
            string[] spanca = caLayout.Split('+');


            for (int i = 0; i < spanca.Length; i++)
            {
                if (spanca[i].Contains("*"))
                {
                    string[] sp = spanca[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spancaLst.Add(v);
                        spancwLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(spanca[i]) > 0)
                    {
                        spancaLst.Add(double.Parse(spanca[i]));
                        spancwLst.Add(double.Parse(spanca[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spancaLst.Add(0);
                    }
                }
            }

            string cmLayout = pierPara.pierRebarOld.main_w_mid_layout;
            string[] spancm = cmLayout.Split('+');


            for (int i = 0; i < spancm.Length; i++)
            {
                if (spancm[i].Contains("*"))
                {
                    string[] sp = spancm[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spancmLst.Add(v);
                        spancwLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(spancm[i]) > 0)
                    {
                        spancmLst.Add(double.Parse(spancm[i]));
                        spancwLst.Add(double.Parse(spancm[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spancmLst.Add(0);
                    }
                }
            }

            for (int i = 0; i < spancaLst.Count; i++)
            {
                spancwLst.Add(spancaLst[spancaLst.Count - 1 - i]);
            }
            for (int i = 0; i < spancsLst.Count; i++)
            {
                spancwLst.Add(spancsLst[spancsLst.Count - 1 - i]);
            }
            #endregion

            #region 承台钢筋分布
            string pileCapLayout = pierPara.pierRebarOld.pilecap_penetration_layout;
            string[] spanPileCap = pileCapLayout.Split('+');

            for (int i = 0; i < spanPileCap.Length; i++)
            {
                if (spanPileCap[i].Contains("*"))
                {
                    string[] sp = spanPileCap[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spanPileCapLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(spanPileCap[i]) > 0)
                    {
                        spanPileCapLst.Add(double.Parse(spanPileCap[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spanPileCapLst.Add(0);
                    }
                }
            }
            #endregion

            #region 横桥向主筋分布
            string cslLayout = pierPara.pierRebarOld.main_l_thickness_layout;
            string[] spancsl = cslLayout.Split('+');


            for (int i = 0; i < spancsl.Length; i++)
            {
                if (spancsl[i].Contains("*"))
                {
                    string[] sp = spancsl[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spancslLst.Add(v);
                        spanclLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(spancsl[i]) > 0)
                    {
                        spancslLst.Add(double.Parse(spancsl[i]));
                        spanclLst.Add(double.Parse(spancsl[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spancslLst.Add(0);
                    }
                }
            }



            string cmlLayout = pierPara.pierRebarOld.main_l_mid_layout;
            string[] spancml = cmlLayout.Split('+');


            for (int i = 0; i < spancml.Length; i++)
            {
                if (spancml[i].Contains("*"))
                {
                    string[] sp = spancml[i].Split('*');
                    int m = int.Parse(sp[0]);
                    double v = double.Parse(sp[1]);
                    for (int n = 0; n < m; n++)
                    {
                        spancmlLst.Add(v);
                        spanclLst.Add(v);
                        //total += v;
                    }
                }
                else
                {
                    if (double.Parse(spancml[i]) > 0)
                    {
                        spancmlLst.Add(double.Parse(spancml[i]));
                        spanclLst.Add(double.Parse(spancml[i]));
                        //total += double.Parse(span[i]);
                    }
                    else
                    {
                        spancmlLst.Add(0);
                    }
                }
            }

            for (int i = 0; i < spancsLst.Count; i++)
            {
                spanclLst.Add(spancsLst[spancsLst.Count - 1 - i]);
            }
            #endregion

            #endregion

        }
        #region  "墩柱钢筋构造图"

        #region 第一页
        /// <summary>
        /// 立面A
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierelEvationA(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "A-A", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
            double BeamW = pierPara.column.top_w * 1.5;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 20 * scale);
            Point3d ptDimL = pt.C3D(-BeamW * 0.5 - 10 * scale);
            double halfPile = 15 * scale;//桩长示意长度

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;
            #region 盖梁外轮廓绘制

            double BeamH = pierPara.pierRebarOld.beam_penetration_depth + 4 * scale;

            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt8 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH * 0.4);
            Point2d pt3 = pt.C2D(-pierPara.column.top_w * 0.5 - 15, -BeamH);
            Point2d pt4 = pt.C2D(-pierPara.column.top_w * 0.5, -BeamH);

            Point2d pt5 = pt4.C2D(pierPara.column.top_w);
            Point2d pt6 = pt5.C2D(15);
            Point2d pt7 = pt8.C2D(0, -BeamH * 0.4);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            ptLst.Add(pt7);
            ptLst.Add(pt8);
            Point2d ptBMid = pt.C2D(0, -BeamH);

            PLPloter.AddPolylineByPointList(db,ptLst, ref ext, "H细线", false);
            PLPloter.CreateBreakLineP(db, ref ext, pt1, pt8, scale, "H细线");

            #region 钢筋绘制
            double total = 0;
            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            for (int i = 0; i < spanBeamLst.Count - 1; i++)
            {
                total += spanBeamLst[i];
                PLPloter.AddLine(db,pt4.C2D(avg, total), pt5.C2D(-avg, total), ref ext, "H钢筋");
            }

            #endregion

            #endregion


            #region 墩身轮廓绘制
            double cap = 2 * scale;

            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[0]);
            double tw = double.Parse(sizeT[1]);
            double mH = double.Parse(sizeM[0]);
            double mw = double.Parse(sizeM[1]);
            double bH = double.Parse(sizeBulk[0]);
            double bw = double.Parse(sizeBulk[1]);
            double bwL = double.Parse(sizeBulkL[1]);
            //string[] thickness = pierPara.column.top_thickness.Split(',');
            //double topThickness = double.Parse(thickness[thickness.Length - 1]);
            //double bottomThickness = double.Parse(thickness[0]);
            //double FH = topH + tH + pierPara.pierRebarOld.top_encryption_spacing * 25.5;
            //double MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //if(BulkheadCount==1)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 80 + mH * 2 + bH;
            //else if (BulkheadCount == 2)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //else
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 30 + mH * 2 + bH;
            //double BH = botH + tH + pierPara.pierRebarOld.bottom_encryption_spacing* 25;
            #region 外轮廓上部
            //double FH = topH  + tH+25*scale;
            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_w * 0.5), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_w * 0.5), -FH);
            PLPloter.AddLine(db,pt4, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt5, ptCF2, ref ext, "H细线");
            //if (pierPara.column.slope_w > 0)
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            //else
            //    PLPloter.CreateBreakLineP(db, ref ext, ptCF1, ptCF2, scale, "H细线");

            DimPloter.AddLeft2RightBJ(db,"E", pt4.C3D(-6 * scale, -3 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"E", pt5.C3D(6 * scale, -3 * scale), ref ext, scale, 3, false);

            DimPloter.AddLeft2RightBJ(db,"F", pt4.C3D(-6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"F", pt5.C3D(6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, false);
            #region 钢筋
            double len = 0;
            PLPloter.AddLine(db,ptCF1.C2D(avg, 0), pt4.C2D(avg, pierPara.pierRebarOld.beam_penetration_depth), ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];

                PLPloter.AddLine(db,ptCF1.C2D(avg + len), pt4.C2D(avg + len, pierPara.pierRebarOld.beam_penetration_depth), ref ext, "H钢筋");
            }
            int numR = (int)(FH / pierPara.pierRebarOld.top_encryption_spacing);
            double lenH = 0;
            for (int i = 1; i <= numR; i++)
            {
                lenH += pierPara.pierRebarOld.top_encryption_spacing;
                PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
            }
            #endregion

            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D();
            Point2d ptICF1 = ptBMid.C2D(-pierPara.column.top_w * 0.5 + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D(pierPara.column.top_w * 0.5 - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);



            #endregion

            #region 外轮廓中部
            //double MH = 40*scale  + mH*2+ bH;
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -cap - MH);
            if (pierPara.column.slope_w > 0)
            {
                TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_w, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                //if(pierPara.column.slope_w>0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                //else
                //     PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(), ptCM2.C2D(), scale, "H墩身");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                //if (pierPara.column.slope_w > 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E, ptCM2E, scale, "H墩身");

                #region 钢筋
                len = 0;
                PLPloter.AddLine(db,ptCM1.C2D(avg), ptCM1E.C2D(avg), ref ext, "H钢筋");
                for (int m = 0; m < spancwLst.Count; m++)
                {
                    len += spancwLst[m];

                    PLPloter.AddLine(db,ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg, -lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            if (m == 1)
                                ptDimT = ptCM1E.C3D(avg, lenH);
                        }
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                    lenH = 0;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                        PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                        PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.top_encryption_spacing;
                        PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg, lenH);
                    }
                }
                #endregion
            }
            #endregion

            #region 内轮廓中部
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            //Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                //Point3d ptMM = GeTools.MidPoint(ptICM3.C3D(), ptICM5.C3D());
                //DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(2 * scale, 5 * scale), pierPara.column.section_mid_w_ang, ref ext, scale);
                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


            }




            #endregion

            #region 外轮廓下部
            //double BH = botH  + tH +25*scale;
            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_w + pierPara.pier_height * 100 * pierPara.column.slope_w;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_w, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale, -cap), ptCM2E.C2D(5 * scale, -cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            //if (pierPara.column.slope_w == 0)
            //    DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //else
            //    DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "Bd1", Unit.Centimeter, Unit.Centimeter);

            numR = (int)((BH - pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth) / pierPara.pierRebarOld.bottom_encryption_spacing);
            lenH = 0;
            for (int i = 0; i < numR; i++)
            {
                if (i > 0)
                    lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                PLPloter.AddLine(db,ptCB1E.C2D(avg, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
            }

            DimPloter.AddLeft2RightBJ(db,"H", ptCB1E.C3D(-6 * scale, botH + tH + 5 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"H", ptCB2E.C3D(6 * scale, botH + tH + 5 * scale), ref ext, scale, 3, false);

            DimPloter.AddLeft2RightBJ(db,"G", ptCB1E.C3D(-6 * scale, botH * 0.5), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"G", ptCB2E.C3D(6 * scale, botH * 0.5), ref ext, scale, 3, false);
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_w + bottomThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w - bottomThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_w + bottomThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_w - bottomThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(bottomThickness, -tH);
            Point2d ptICB6 = ptICB4.C2D(-bottomThickness, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
            #endregion


            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.pileCap.pile_cap_width;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", true);

            #region 钢筋绘制
            total = 0;
            for (int i = 0; i < spanPileCapLst.Count; i++)
            {
                total += spanPileCapLst[spanPileCapLst.Count - 1 - i];

                //Point2d ptbt2 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + pierPara.pierRebarOld.pier_protect_layer, -total);
                if (i == spanPileCapLst.Count - 1)
                {
                    len = 0;
                    Point2d ptbt1 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total);
                    PLPloter.AddLine(db,ptCB1.C2D(avg), ptbt1, ref ext, "H钢筋");
                    for (int m = 0; m < spancwLst.Count; m++)
                    {
                        len += spancwLst[m];

                        PLPloter.AddLine(db,ptCB1.C2D(avg + len), ptbt1.C2D(len), ref ext, "H钢筋");

                        DimPloter.DimRot(db, ptbt1.C3D(), ptbt1.C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                        DimPloter.DimRot(db, ptBottomC.C3D(), ptbt1.C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    }
                    //ptCB1
                }
                else
                {
                    PLPloter.AddLine(db,ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total), ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg, -total), ref ext, "H钢筋");

                }
            }
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing + "-" + pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            string v = avg + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_mid_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5), ptBottomC.C3D(0, -pileCapH - 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5), ptBottomC.C3D(0, -pileCapH - 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion

            #endregion

            List<double> lList = new List<double>();
            lList.Add(pierPara.column.top_w - avg * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-pierPara.column.top_w * 0.5 + avg, -pierPara.pierRebarOld.pilecap_penetration_depth + 20), ArrowDirection.West, new List<double>(), lList, "1", scale, true, 4, 5 * scale);


            lList = new List<double>();

            for (int i = 0; i < 10; i++)
            {
                lList.Add(pierPara.pierRebarOld.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebarOld.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_w * 0.5, 10 * pierPara.pierRebarOld.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "3", scale, true, 1, pierPara.column.top_w * 0.5 + 5 * scale);
        }


        /// <summary>
        /// 侧面C
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierSideC(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "C-C", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
            //Point3d ptDim = pt.C3D(pierPara.pileCap.pile_cap_length * 0.5 + 10 * scale);
            //double halfPile = 15 * scale;//桩长示意长度
            double BeamW = pierPara.column.top_l + 20;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 20 * scale);
            Point3d ptDimL = pt.C3D(-pierPara.pileCap.pile_cap_length * 0.5 - 15 * scale);

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;
            #region 盖梁外轮廓绘制
            double BeamH = pierPara.pierRebarOld.beam_penetration_depth + 4 * scale;

            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt6 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH);
            Point2d pt3 = pt.C2D(-pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt4 = pt.C2D(pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt5 = pt6.C2D(0, -BeamH);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            Point2d ptBMid = pt.C2D(0, -BeamH);

            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", true);
            //PLPloter.CreateBreakLineP(db, ref ext, pt1, pt6, scale, "H细线");


            #region 钢筋绘制

            double total = 0;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avg = (pierPara.column.top_l - lenL) * 0.5;
            for (int i = 0; i < spanBeamLst.Count - 1; i++)
            {
                total += spanBeamLst[i];
                PLPloter.AddLine(db,pt3.C2D(avg + total * pierPara.column.slope_l, total), pt4.C2D(-avg - total * pierPara.column.slope_l, total), ref ext, "H钢筋");
            }

            #endregion

            #endregion



            #region 墩身外轮廓绘制
            double cap = 2 * scale;
            int BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_l_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_l_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[0]);
            double tw = double.Parse(sizeT[1]);
            double mH = double.Parse(sizeM[0]);
            double mw = double.Parse(sizeM[1]);
            double bH = double.Parse(sizeBulk[0]);
            double bw = double.Parse(sizeBulk[1]);
            //string[] thickness = pierPara.column.top_thickness.Split(',');
            //double topThickness = double.Parse(thickness[thickness.Length - 1]);
            //double bottomThickness = double.Parse(thickness[0]);
            //double FH = topH + tH + pierPara.pierRebarOld.top_encryption_spacing * 25.5;
            //double MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //if (BulkheadCount == 1)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 80 + mH * 2 + bH;
            //else if (BulkheadCount == 2)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //else
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 30 + mH * 2 + bH;
            //double BH = botH + tH + pierPara.pierRebarOld.bottom_encryption_spacing * 25;
            #region 外轮廓上部

            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            PLPloter.AddLine(db,pt3, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt4, ptCF2, ref ext, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");

            #region 钢筋
            double len = 0;

            Point2d ptSt = pt3.C2D(avg + pierPara.pierRebarOld.beam_penetration_depth * pierPara.column.slope_l, pierPara.pierRebarOld.beam_penetration_depth);
            double stL = lenL - pierPara.pierRebarOld.beam_penetration_depth * pierPara.column.slope_l * 2;
            List<Point2d> ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            Point2d ptEnd = ptCF1.C2D(avg);
            double endL = lenL + FH * pierPara.column.slope_l * 2;
            List<Point2d> ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
            PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            for (int m = 0; m < ptTLst.Count; m++)
            {
                PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            }
            int numR = (int)(FH / pierPara.pierRebarOld.top_encryption_spacing);
            double lenH = 0;
            for (int i = 1; i <= numR; i++)
            {
                lenH += pierPara.pierRebarOld.top_encryption_spacing;
                PLPloter.AddLine(db,ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
            }
            #endregion
            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D(0, -topH);
            Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            #endregion

            #region 外轮廓中部

            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);

            //if (pierPara.column.slope_l > 0)
            //{
            //    TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_l, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            //}
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                if (i < BulkheadCount - 1)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");

                #region 钢筋

                ptSt = ptCM1.C2D(avg);
                stL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2;
                ptTLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
                ptEnd = ptCM1E.C2D(avg);
                endL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2;
                ptBLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
                PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                for (int m = 0; m < ptTLst.Count; m++)
                {
                    PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg - lenH * pierPara.column.slope_l, -lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        }
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            if (m == 1)
                                ptDimT = ptCM1E.C3D(avg, lenH);
                        }
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                    lenH = 0;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                        PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                        PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.top_encryption_spacing;
                        PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                }
                #endregion
            }


            #endregion

            #region 内轮廓中部
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            //Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");


                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            }



            #endregion

            #region 外轮廓下部

            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_l, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            //PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale, cap), ptCB2.C2D(5 * scale, cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            numR = (int)((BH - pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth) / pierPara.pierRebarOld.bottom_encryption_spacing);
            lenH = 0;
            for (int i = 0; i < numR; i++)
            {
                if (i > 0)
                    lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                PLPloter.AddLine(db,ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
            }
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_l + bottomThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l - bottomThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_l + bottomThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_l - bottomThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


            #endregion

            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.pileCap.pile_cap_length;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", true);

            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(-pileCapW * 0.5, -pileCapH), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0,-10*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            #region 钢筋绘制
            total = 0;
            for (int i = 0; i < spanPileCapLst.Count; i++)
            {
                total += spanPileCapLst[spanPileCapLst.Count - 1 - i];
                if (i == spanPileCapLst.Count - 1)
                {
                    ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
                    stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
                    ptTLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst, pierPara.pierRebarOld.main_l_change_num);
                    ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg - pierPara.pierRebarOld.pilecap_penetration_depth * pierPara.column.slope_l, -pierPara.pierRebarOld.pilecap_penetration_depth);
                    endL = BottomW - 2 * avg + pierPara.pierRebarOld.pilecap_penetration_depth * pierPara.column.slope_l * 2;
                    ptBLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst, pierPara.pierRebarOld.main_l_change_num);
                    PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                    for (int m = 0; m < ptTLst.Count; m++)
                    {
                        PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                    }

                    DimPloter.DimRot(db, ptBLst[0].C3D(), ptBLst[0].C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBottomC.C3D(), ptBLst[0].C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
                else
                {
                    PLPloter.AddLine(db,ptBottomC.C2D(-BottomW * 0.5 + avg - total * pierPara.column.slope_l, -total), ptBottomC.C2D(BottomW * 0.5 - avg + total * pierPara.column.slope_l, -total), ref ext, "H钢筋");

                }
            }

            #endregion

            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing + "-" + pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            string v = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -pileCapH - 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -pileCapH - 10 * scale), ref ext, 0, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);

            #endregion

            double bLen = pierPara.column.top_l + 20 * pierPara.column.slope_l;
            List<double> lList = new List<double>();
            lList.Add(bLen - avg * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBMid.C3D(-bLen * 0.5 + avg, -20), ArrowDirection.West, new List<double>(), spanclLst, "1", scale, true, 4, 5 * scale);

            double vbl = BottomW - 2 * avg + (pierPara.pierRebarOld.pilecap_penetration_depth - 20) * pierPara.column.slope_l * 2;
            List<double> vbLst = new List<double>();
            RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vbl, out vbLst, pierPara.pierRebarOld.main_l_change_num);
            List<double> vb1Lst = new List<double>();
            double lenv = 0;
            for (int i = 0; i < vbLst.Count; i++)
            {
                if (i >= spancslLst.Count - 1 && i <= spancslLst.Count + pierPara.pierRebarOld.main_l_change_num)
                {
                    lenv += vbLst[i];
                    if (i == spancslLst.Count + pierPara.pierRebarOld.main_l_change_num)
                        vb1Lst.Add(lenv);
                }
                else if (i >= vbLst.Count - (spancslLst.Count + pierPara.pierRebarOld.main_l_change_num) - 1 && i <= vbLst.Count - spancslLst.Count)
                {
                    if (i == vbLst.Count - spancslLst.Count)
                        vb1Lst.Add(lenv);
                }

                else
                    vb1Lst.Add(vbLst[i]);
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-vbl * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth + 20), ArrowDirection.West, new List<double>(), vb1Lst, "1", scale, true, 15, 0 * scale);


            double vb2 = BottomW - 2 * avg + (pierPara.pierRebarOld.pilecap_penetration_depth - 30) * pierPara.column.slope_l * 2;
            List<double> vb20Lst = new List<double>();
            RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vb2, out vb20Lst, pierPara.pierRebarOld.main_l_change_num);
            List<double> vb2Lst = new List<double>();
            double lenv2 = 0;
            double lenv3 = 0;
            for (int i = 0; i < vbLst.Count; i++)
            {
                if (i < spancslLst.Count)
                {
                    lenv2 += vbLst[i];
                }
                else if (i >= spancslLst.Count - 1 && i < spancslLst.Count + pierPara.pierRebarOld.main_l_change_num)
                {
                    vb2Lst.Add(vbLst[i]);
                }
                else if (i >= spancslLst.Count + pierPara.pierRebarOld.main_l_change_num && i < vbLst.Count - (spancslLst.Count + pierPara.pierRebarOld.main_l_change_num))
                {
                    lenv3 += vbLst[i];
                    if (i == vbLst.Count - (spancslLst.Count + pierPara.pierRebarOld.main_l_change_num) - 1)
                    {
                        vb2Lst.Add(lenv3);
                    }
                }
                else if (i >= vbLst.Count - (spancslLst.Count + pierPara.pierRebarOld.main_l_change_num) && i < vbLst.Count - spancslLst.Count)
                {

                    vb2Lst.Add(vbLst[i]);
                }

            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBottomC.C3D(-vb2 * 0.5 + lenv2, -pierPara.pierRebarOld.pilecap_penetration_depth + 30), ArrowDirection.West, new List<double>(), vb2Lst, "2", scale, true, 15, 5 * scale);

            lList = new List<double>();

            for (int i = 0; i < 10; i++)
            {
                lList.Add(pierPara.pierRebarOld.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebarOld.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_l * 0.5, 10 * pierPara.pierRebarOld.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "4", scale, true, 1, pierPara.column.top_l * 0.5 + 5 * scale);
        }
        #endregion

        #region 第二页（点筋）

        /// <summary>
        /// 立面A
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierelEvationB(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "B-B", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);

            double BeamW = pierPara.column.top_w * 1.5;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 20 * scale);
            Point3d ptDimL = pt.C3D(-BeamW * 0.5 - 10 * scale);
            //Point3d ptDimR = pt.C3D(pierPara.beam_w * 0.5 + 20 * scale);
            double halfPile = 15 * scale;//桩长示意长度
            double spaceLen = spancsLst.Sum();

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;

            #region 盖梁外轮廓绘制

            double BeamH = pierPara.pierRebarOld.beam_penetration_depth + 4 * scale;
            //double BeamW = pierPara.column.top_w * 1.5;
            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt8 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH * 0.4);
            Point2d pt3 = pt.C2D(-pierPara.column.top_w * 0.5 - 15, -BeamH);
            Point2d pt4 = pt.C2D(-pierPara.column.top_w * 0.5, -BeamH);

            Point2d pt5 = pt4.C2D(pierPara.column.top_w);
            Point2d pt6 = pt5.C2D(15);
            Point2d pt7 = pt8.C2D(0, -BeamH * 0.4);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            ptLst.Add(pt7);
            ptLst.Add(pt8);
            Point2d ptBMid = pt.C2D(0, -BeamH);

            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", false);
            PLPloter.CreateBreakLineP(db, ref ext, pt1, pt8, scale, "H细线");

            #region 钢筋绘制
            double total = 0;
            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            for (int i = 0; i < spanBeamLst.Count - 1; i++)
            {
                total += spanBeamLst[i];
                //PLPloter.AddLine(db,pt4.C2D(avg, total), pt5.C2D(-avg, total), ref ext, "H钢筋");
                PLPloter.AddLine(db,pt4.C2D(avg, total), pt4.C2D(avg + spaceLen, total), ref ext, "H钢筋");
                PLPloter.AddLine(db,pt5.C2D(-avg - spaceLen, total), pt5.C2D(-avg, total), ref ext, "H钢筋");
            }

            #endregion

            #endregion


            #region 墩身轮廓绘制
            double cap = 2 * scale;
            int BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_w_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[0]);
            double tw = double.Parse(sizeT[1]);
            double mH = double.Parse(sizeM[0]);
            double mw = double.Parse(sizeM[1]);
            double bH = double.Parse(sizeBulk[0]);
            double bw = double.Parse(sizeBulk[1]);
            double bwL = double.Parse(sizeBulkL[1]);
            //string[] thickness = pierPara.column.top_thickness.Split(',');
            //double topThickness = double.Parse(thickness[thickness.Length - 1]);
            //double bottomThickness = double.Parse(thickness[0]);
            //double FH = topH + tH + pierPara.pierRebarOld.top_encryption_spacing * 25.5;
            //double MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //if (BulkheadCount == 1)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 80 + mH * 2 + bH;
            //else if (BulkheadCount == 2)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //else
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 30 + mH * 2 + bH;
            //double BH = botH + tH + pierPara.pierRebarOld.bottom_encryption_spacing * 25;
            #region 外轮廓上部
            //double FH = topH  + tH+25*scale;
            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_w * 0.5), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_w * 0.5), -FH);
            PLPloter.AddLine(db,pt4, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt5, ptCF2, ref ext, "H细线");
            //if (pierPara.column.slope_w > 0)
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");
            //else
            //    PLPloter.CreateBreakLineP(db, ref ext, ptCF1, ptCF2, scale, "H细线");

            DimPloter.AddLeft2RightBJ(db,"E", pt4.C3D(-6 * scale, -3 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"E", pt5.C3D(6 * scale, -3 * scale), ref ext, scale, 3, false);

            DimPloter.AddLeft2RightBJ(db,"F", pt4.C3D(-6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"F", pt5.C3D(6 * scale, -topH - tH - 5 * scale), ref ext, scale, 3, false);
            #region 钢筋
            double len = 0;
            PLPloter.AddLine(db,ptCF1.C2D(avg, 0), pt4.C2D(avg, pierPara.pierRebarOld.beam_penetration_depth), ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];
                if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                    PLPloter.AddLine(db,ptCF1.C2D(avg + len), pt4.C2D(avg + len, pierPara.pierRebarOld.beam_penetration_depth), ref ext, "H钢筋");
            }
            int numR = (int)(FH / pierPara.pierRebarOld.top_encryption_spacing);
            double lenH = 0;
            for (int i = 1; i <= numR; i++)
            {
                lenH += pierPara.pierRebarOld.top_encryption_spacing;
                //PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptCF1.C2D(avg, lenH), ptCF1.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptCF2.C2D(-avg - spaceLen, lenH), ptCF2.C2D(-avg, lenH), ref ext, "H钢筋");
            }
            #endregion

            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D();
            Point2d ptICF1 = ptBMid.C2D(-pierPara.column.top_w * 0.5 + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D(pierPara.column.top_w * 0.5 - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            //List<Point3d> treLst;
            //List<double> lst = new List<double>();
            //double le = spancmLst.Sum();
            //for (int m = 0; m < spancaLst.Count; m++)
            //{
            //    if (m == 0)
            //        lst.Add(spancaLst[m] - radius);
            //    else
            //        lst.Add(spancaLst[m]);
            //}
            //for (int m = 0; m < spancmLst.Count; m++)
            //{
            //    lst.Add(spancmLst[m]);
            //}
            //for (int m = 0; m < spancaLst.Count; m++)
            //{
            //    if (m == spancaLst.Count - 1)
            //        lst.Add(spancaLst[m] - radius);
            //    else
            //        lst.Add(spancaLst[m]);
            //}
            //le = lst.Sum();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, ptIC.C2D(-le*0.5, -topH + pierPara.pierRebarOld.concrete_protect_layer),
            //    radius, lst, scale, 0, out treLst, false);
            //PLPloter.AddLine(db,ptIC.C2D(-le * 0.5-radius, -topH + pierPara.pierRebarOld.concrete_protect_layer + radius), ptIC.C2D(le * 0.5+ radius, -topH + pierPara.pierRebarOld.concrete_protect_layer + radius), ref ext, "H钢筋");

            //List<Point2d> ptTCLst = new List<Point2d>();
            Point2d ptTC = ptIC.C2D(-pierPara.column.top_w * 0.5 + avg, -(topH - pierPara.pierRebarOld.concrete_protect_layer));
            double endTCL = pierPara.column.top_w - avg * 2;
            List<Point3d> ptHLst = new List<Point3d>();
            List<double> ptHSLst = new List<double>();
            string spH = "";
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptTC.C2D(spaceLen + radius),
               radius, endTCL - spaceLen * 2 - radius * 2, endTCL - spaceLen * 2 - radius * 2, pierPara.pierRebarOld.pier_solid_reinforcement_l_space, 0, radius, out ptHLst, out ptHSLst, out spH, eDirection.E_TOP, true);
            PLPloter.AddLine(db,ptTC, ptTC.C2D(endTCL), ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_BOTTOM, ptHLst, "6", ptHLst.Count / 8, ptHLst.Count / 8, scale, false, 5 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptHLst[ptHLst.Count / 2].C3D(radius * 3, -radius), ArrowDirection.North, new List<double>(), new List<double>(), "7", scale, true, scale, 0 * scale);

            #region 8#，10#
            double ang = Math.Atan(tw / tH);
            Line l1 = new Line(ptICF1.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICF1.C2D(tw, tH).C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            double lenLine = l1.Length;

            Point3d p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 1.4).C3D();
            Point3d p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            List<Point3d> ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);

            Point3d ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "8", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

            Line l2 = new Line(ptICF2.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICF2.C2D(-tw, tH).C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            double lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine2 * 1.4).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenLine2 * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion

            #endregion

            #region 外轮廓中部
            //double MH = 40*scale  + mH*2+ bH;
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_w, -cap - MH);
            if (pierPara.column.slope_w > 0)
            {
                TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_w, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            }
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w, -cap * (i + 1) - MH * (i + 1));
                //if(pierPara.column.slope_w>0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                //else
                //     PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(), ptCM2.C2D(), scale, "H墩身");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                //if (pierPara.column.slope_w > 0)
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                //else
                //    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E, ptCM2E, scale, "H墩身");

                #region 钢筋
                len = 0;
                PLPloter.AddLine(db,ptCM1.C2D(avg), ptCM1E.C2D(avg), ref ext, "H钢筋");
                for (int m = 0; m < spancwLst.Count; m++)
                {
                    len += spancwLst[m];
                    if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                        PLPloter.AddLine(db,ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");

                            PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM1.C2D(avg + spaceLen, -lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2.C2D(-avg - spaceLen, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg, -lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM1.C2D(avg, -lenH), ptCM1.C2D(avg + spaceLen, -lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2.C2D(-avg - spaceLen, -lenH), ptCM2.C2D(-avg, -lenH), ref ext, "H钢筋");
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                    }
                    else
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        }
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                            if (m == 1)
                                ptDimT = ptCM1E.C3D(avg, lenH);
                        }
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                    lenH = 0;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.top_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                        PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg, lenH);
                    }
                }
                #endregion
            }
            #endregion

            #region 内轮廓中部
            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            double HB = (MH - mH * 2 - bH) * 0.5;
            //Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            for (int i = 0; i < BulkheadCount; i++)
            {
                ptLst = new List<Point2d>();
                ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i);
                ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i);
                Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - HB);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                //Point3d ptMM = GeTools.MidPoint(ptICM3.C3D(), ptICM5.C3D());
                //DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(2 * scale, 5 * scale), pierPara.column.section_mid_w_ang, ref ext, scale);
                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

                #endregion

                ptLst = new List<Point2d>();
                Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * (i + 1));
                Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * (i + 1));
                ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_w - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


            }




            #endregion

            #region 外轮廓下部
            //double BH = botH  + tH +25*scale;
            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_w + pierPara.pier_height * 100 * pierPara.column.slope_w;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_w, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale, -cap), ptCM2E.C2D(5 * scale, -cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            //if (pierPara.column.slope_w == 0)
            //    DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);
            //else
            //    DimPloter.DimRot(db, ptBottomC.C3D(-BottomW * 0.5), ptBottomC.C3D(BottomW * 0.5), ptBottomC.C3D(0, -8 * scale), ref ext, 0, scale, "Bd1", Unit.Centimeter, Unit.Centimeter);

            numR = (int)((BH - pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth) / pierPara.pierRebarOld.bottom_encryption_spacing);
            lenH = 0;
            for (int i = 0; i < numR; i++)
            {
                if (i > 0)
                    lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                //PLPloter.AddLine(db,ptCB1E.C2D(avg, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");

                PLPloter.AddLine(db,ptCB1E.C2D(avg, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptCB1E.C2D(avg + spaceLen, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptCB2E.C2D(-avg - spaceLen, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
            }

            DimPloter.AddLeft2RightBJ(db,"H", ptCB1E.C3D(-6 * scale, botH + tH + 5 * scale), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"H", ptCB2E.C3D(6 * scale, botH + tH + 5 * scale), ref ext, scale, 3, false);

            DimPloter.AddLeft2RightBJ(db,"G", ptCB1E.C3D(-6 * scale, botH * 0.5), ref ext, scale, 3, true);
            DimPloter.AddLeft2RightBJ(db,"G", ptCB2E.C3D(6 * scale, botH * 0.5), ref ext, scale, 3, false);
            #endregion

            #region 内轮廓下部
            ptLst = new List<Point2d>();
            double BIH = botH + tH;
            //Point2d ptCB1IE = ptBottomC.C2D(-BottomW * 0.5+bottomThickness);
            //Point2d ptCB2IE = ptBottomC.C2D(BottomW * 0.5- bottomThickness);
            Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_w + topThickness, BH);
            Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_w - topThickness, BH);
            Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_w + topThickness, BIH);
            Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_w - topThickness, BIH);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, ptBottomC.C2D(-le * 0.5, botH - pierPara.pierRebarOld.concrete_protect_layer - radius),
            //  radius, lst, scale, 0, out treLst, false);
            //PLPloter.AddLine(db,ptBottomC.C2D(-le * 0.5 - radius, botH - pierPara.pierRebarOld.concrete_protect_layer), ptBottomC.C2D(le * 0.5 + radius, botH - pierPara.pierRebarOld.concrete_protect_layer ), ref ext, "H钢筋");

            Point2d ptBC = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, (botH - pierPara.pierRebarOld.concrete_protect_layer));
            double endBCL = pierPara.column.top_w - avg * 2;
            List<Point3d> ptHBLst = new List<Point3d>();
            List<double> ptHSBLst = new List<double>();
            string spBH = "";
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptBC.C2D(spaceLen + radius),
               radius, endBCL - spaceLen * 2 - radius * 2, endTCL - spaceLen * 2 - radius * 2, pierPara.pierRebarOld.pier_solid_reinforcement_l_space, 0, radius, out ptHBLst, out ptHSBLst, out spBH, eDirection.E_BOTTOM, true);
            PLPloter.AddLine(db,ptBC, ptBC.C2D(endBCL), ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_TOP, ptHBLst, "6", ptHBLst.Count / 8, ptHBLst.Count / 8, scale, false, 5 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptHBLst[ptHBLst.Count / 2].C3D(radius * 3, radius), ArrowDirection.South, new List<double>(), new List<double>(), "7", scale, true, scale, 0 * scale);
            #endregion

            #region 8#，10#

            l1 = new Line(ptICB3.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICB5.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            lenLine = l1.Length;

            p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 1.4).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);

            ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "8", 3 * scale, scale, GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));


            l2 = new Line(ptICB4.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICB6.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine2 * 1.4).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenLine2 * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion
            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.pileCap.pile_cap_width;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", true);

            #region 钢筋绘制
            total = 0;
            for (int i = 0; i < spanPileCapLst.Count; i++)
            {
                total += spanPileCapLst[spanPileCapLst.Count - 1 - i];

                //Point2d ptbt2 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + pierPara.pierRebarOld.pier_protect_layer, -total);
                if (i == spanPileCapLst.Count - 1)
                {
                    len = 0;
                    Point2d ptbt1 = ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total);
                    PLPloter.AddLine(db,ptCB1.C2D(avg), ptbt1, ref ext, "H钢筋");
                    for (int m = 0; m < spancwLst.Count; m++)
                    {
                        len += spancwLst[m];
                        if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                            PLPloter.AddLine(db,ptCB1.C2D(avg + len), ptbt1.C2D(len), ref ext, "H钢筋");
                    }

                    DimPloter.DimRot(db, ptbt1.C3D(), ptbt1.C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBottomC.C3D(), ptbt1.C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
                else
                {
                    //PLPloter.AddLine(db,ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total), ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg, -total), ref ext, "H钢筋");

                    PLPloter.AddLine(db,ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg, -total), ptBottomC.C2D(-pierPara.column.top_w * 0.5 + avg + spaceLen, -total), ref ext, "H钢筋");
                    PLPloter.AddLine(db,ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg, -total), ptBottomC.C2D(pierPara.column.top_w * 0.5 - avg - spaceLen, -total), ref ext, "H钢筋");
                }
            }

            #endregion
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing + "-" + pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);

            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            #endregion


            List<double> lList = new List<double>();

            for (int i = 0; i < 10; i++)
            {
                lList.Add(pierPara.pierRebarOld.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebarOld.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_w - bottomThickness * 0.6, 10 * pierPara.pierRebarOld.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "4", "4a", scale, true, 1, 5 * scale);
        }


        /// <summary>
        /// 侧面C
        /// </summary>
        /// <param name="db"></param>
        /// <param name="ext"></param>
        /// <param name="insertPoint"></param>
        /// <param name="pierPara"></param>
        /// <param name="_scale"></param>
        public void PlotPierSideD(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "D-D", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
            //Point3d ptDim = pt.C3D(pierPara.pileCap.pile_cap_length * 0.5 + 10 * scale);
            //double halfPile = 15 * scale;//桩长示意长度

            double BeamW = pierPara.column.top_l + 20;
            Point3d ptDim = pt.C3D(-pierPara.column.top_w * 0.5 - 20 * scale);
            Point3d ptDimL = pt.C3D(-pierPara.pileCap.pile_cap_length * 0.5 - 15 * scale);

            Point3d ptDimT = ptDim;
            Point3d ptDimB = ptDim;
            #region 盖梁外轮廓绘制
            double BeamH = pierPara.pierRebarOld.beam_penetration_depth + 4 * scale;
            //double BeamW = pierPara.column.top_l + 20;
            List<Point2d> ptLst = new List<Point2d>();
            Point2d pt1 = pt.C2D(-BeamW * 0.5);
            Point2d pt6 = pt.C2D(BeamW * 0.5);
            Point2d pt2 = pt1.C2D(0, -BeamH);
            Point2d pt3 = pt.C2D(-pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt4 = pt.C2D(pierPara.column.top_l * 0.5, -BeamH);
            Point2d pt5 = pt6.C2D(0, -BeamH);

            ptLst.Add(pt1);
            ptLst.Add(pt2);
            ptLst.Add(pt3);
            ptLst.Add(pt4);
            ptLst.Add(pt5);
            ptLst.Add(pt6);
            Point2d ptBMid = pt.C2D(0, -BeamH);

            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", true);
            //PLPloter.CreateBreakLineP(db, ref ext, pt1, pt6, scale, "H细线");


            #region 钢筋绘制

            double total = 0;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avg = (pierPara.column.top_l - lenL) * 0.5;
            for (int i = 0; i < spanBeamLst.Count - 1; i++)
            {
                total += spanBeamLst[i];
                Point2d ptV1 = pt3.C2D(avg + total * pierPara.column.slope_l, total);
                double vL = lenL - total * pierPara.column.slope_l * 2;
                List<Point2d> ptVLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
            }

            #endregion

            #endregion



            #region 墩身外轮廓绘制
            double cap = 2 * scale;
            int BulkheadCount = 2;
            double columnH = (pierPara.h3 - pierPara.h2) * 100;
            //double angC = (pierPara.column.BottowW - pierPara.column.top_w)/(pierPara.h3- pierPara.h2);
            double topH = pierPara.column.top_solid_h;
            double botH = pierPara.column.bottom_solid_h;
            string[] sizeT = pierPara.column.section_l_ang.Split('*');
            string[] sizeM = pierPara.column.section_mid_l_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_l.Split('*');
            double tH = double.Parse(sizeT[0]);
            double tw = double.Parse(sizeT[1]);
            double mH = double.Parse(sizeM[0]);
            double mw = double.Parse(sizeM[1]);
            double bH = double.Parse(sizeBulk[0]);
            double bw = double.Parse(sizeBulk[1]);
            //string[] thickness = pierPara.column.top_thickness.Split(',');
            //double topThickness = double.Parse(thickness[thickness.Length - 1]);
            //double bottomThickness = double.Parse(thickness[0]);
            //double FH = topH + tH + pierPara.pierRebarOld.top_encryption_spacing * 25.5;
            //double MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //if (BulkheadCount == 1)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 80 + mH * 2 + bH;
            //else if (BulkheadCount == 2)
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 40 + mH * 2 + bH;
            //else
            //    MH = pierPara.pierRebarOld.middle_encryption_spacing * 30 + mH * 2 + bH;
            //double BH = botH + tH + pierPara.pierRebarOld.bottom_encryption_spacing * 25;
            #region 外轮廓上部

            Point2d ptCF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            Point2d ptCF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + FH * pierPara.column.slope_l), -FH);
            PLPloter.AddLine(db,pt3, ptCF1, ref ext, "H细线");
            PLPloter.AddLine(db,pt4, ptCF2, ref ext, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCF1.C2D(-5 * scale), ptCF2.C2D(5 * scale), scale, "H细线");

            #region 钢筋
            double len = 0;

            Point2d ptSt = pt3.C2D(avg + pierPara.pierRebarOld.beam_penetration_depth * pierPara.column.slope_l, pierPara.pierRebarOld.beam_penetration_depth);
            double stL = lenL - pierPara.pierRebarOld.beam_penetration_depth * pierPara.column.slope_l * 2;
            List<Point2d> ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            Point2d ptEnd = ptCF1.C2D(avg);
            double endL = lenL + FH * pierPara.column.slope_l * 2;
            List<Point2d> ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
            PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
            for (int m = 0; m < ptTLst.Count; m++)
            {
                if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
                    PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
            }
            int numR = (int)(FH / pierPara.pierRebarOld.top_encryption_spacing);
            double lenH = 0;
            for (int i = 1; i <= numR; i++)
            {
                lenH += pierPara.pierRebarOld.top_encryption_spacing;
                Point2d ptV1 = ptCF1.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                double vL = lenL + FH * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                List<Point2d> ptVLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                //PLPloter.AddLine(db,ptCF1.C2D(avg + (lenH) * pierPara.column.slope_l, lenH), ptCF2.C2D(-avg - (lenH) * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
            }
            #endregion
            #endregion

            #region 内轮廓上部

            Point2d ptIC = ptBMid.C2D(0, -topH);
            Point2d ptICF1 = ptBMid.C2D(-(pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) + topThickness, -(topH + tH));
            Point2d ptICF2 = ptBMid.C2D((pierPara.column.top_l * 0.5 + (topH + tH) * pierPara.column.slope_l) - topThickness, -(topH + tH));
            ptLst = new List<Point2d>();
            //ptLst.Add(ptCF1.C2D(topThickness));
            ptLst.Add(ptBLst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer));
            ptLst.Add(ptICF1.C2D());
            ptLst.Add(ptICF1.C2D(tw, tH));
            ptLst.Add(ptICF2.C2D(-tw, tH));
            ptLst.Add(ptICF2.C2D());
            ptLst.Add(ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer));
            //ptLst.Add(ptCF2.C2D(-topThickness));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            List<Point2d> ptTCLst = new List<Point2d>();
            Point2d ptTC = ptIC.C2D(-pierPara.column.top_l * 0.5 - (topH - pierPara.pierRebarOld.concrete_protect_layer) * pierPara.column.slope_l + avg, pierPara.pierRebarOld.concrete_protect_layer);
            double endTCL = lenL + (topH - pierPara.pierRebarOld.concrete_protect_layer) * pierPara.column.slope_l * 2;
            RebarArrangement.ArrangePoint(ptTC, spancslLst, spancmlLst, lenL, endTCL, out ptTCLst);
            for (int m = 0; m < ptTCLst.Count; m++)
            {
                if (m == spancslLst.Count)
                    PLPloter.AddLine(db,ptTCLst[m], ptTCLst[spanclLst.Count - spancslLst.Count], ref ext, "H钢筋");
            }
            List<Point3d> ptHLst = new List<Point3d>();
            List<double> ptHSLst = new List<double>();
            string spH = "";
            double le = ptTCLst[spanclLst.Count - spancslLst.Count].X - ptTCLst[spancslLst.Count].X - 2 * radius;
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptTCLst[spancslLst.Count].C2D(radius),
               radius, le, le, pierPara.pierRebarOld.pier_solid_reinforcement_w_space, 0, radius, out ptHLst, out ptHSLst, out spH, eDirection.E_TOP, true);
            PLPloter.AddLine(db,ptTCLst[0], ptTCLst[ptTCLst.Count - 1], ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_BOTTOM, ptHLst, "7", ptHLst.Count / 5, ptHLst.Count / 5, scale, false, 5 * scale);

            #region 8#，10#
            double ang = Math.Atan(tw / tH);
            Line l1 = new Line(ptICF1.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICF1.C2D(tw, tH).C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            double lenLine = l1.Length;

            Point3d p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 1.4).C3D();
            Point3d p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            List<Point3d> ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            Point3d ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "10", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "8", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));

            Line l2 = new Line(ptICF2.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICF2.C2D(-tw, tH).C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            double lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine2 * 1.4).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenLine2 * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion

            #endregion

            #region 中部
            double HB = (MH - mH * 2 - bH) * 0.5;
            Point2d ptCM1 = ptCF1.C2D(0, -cap);
            Point2d ptCM2 = ptCF2.C2D(0, -cap);
            Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_l, -cap - MH);
            Point2d ptCM2E = ptCF2.C2D((MH) * pierPara.column.slope_l, -cap - MH);


            Point2d ptICM = ptBMid.C2D(0, -FH - cap);
            Point2d ptICM1 = ptCF1.C2D(0, -cap);
            Point2d ptICM2 = ptCF2.C2D(0, -cap);
            //if (pierPara.column.slope_l > 0)
            //{
            //    TextPloter.AddDBText(db,ptCM2.C3D(6 * scale, -10 * scale), ref ext, "1:" + 1 / pierPara.column.slope_l, scale, 2.5, "SRB.HT", GeTools.DegreeToRadian(90));
            //}
            for (int i = 0; i < BulkheadCount; i++)
            {
                #region 外轮廓
                ptCM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l, -cap * (i + 1) - MH * i);
                ptCM1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                ptCM2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l, -cap * (i + 1) - MH * (i + 1));
                PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");
                PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
                PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");
                if (i < BulkheadCount - 1)
                    PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");
                #endregion

                #region 钢筋

                ptSt = ptCM1.C2D(avg);
                stL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2;
                ptTLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
                ptEnd = ptCM1E.C2D(avg);
                endL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2;
                ptBLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);

                Point2d ptStE = ptCM1.C2D(avg - HB * pierPara.column.slope_l, -HB);
                double stLE = lenL + FH * pierPara.column.slope_l * 2 + ((MH) * i + HB) * pierPara.column.slope_l * 2;
                List<Point2d> ptTELst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptStE, spancslLst, spancmlLst, lenL, stLE, out ptTELst);
                Point2d ptEndS = ptCM1E.C2D(avg + HB * pierPara.column.slope_l, HB);
                double endLS = lenL + FH * pierPara.column.slope_l * 2 + ((MH) * (i + 1) - HB) * pierPara.column.slope_l * 2;
                List<Point2d> ptBSLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptEndS, spancslLst, spancmlLst, lenL, endLS, out ptBSLst);

                PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                for (int m = 0; m < ptTLst.Count; m++)
                {
                    if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
                        PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                }

                if (BulkheadCount > 1)
                {
                    if (i == 0)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                            if (m == 10)
                                ptDimT = ptCM1.C3D(avg - lenH * pierPara.column.slope_l, -lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH), ptCM2.C2D(-avg + lenH * pierPara.column.slope_l, -lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1.C2D(avg - lenH * pierPara.column.slope_l, -lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * i * pierPara.column.slope_l * 2 + lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                    }
                    else if (i == BulkheadCount - 1)
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH), ptCM2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                        }
                    }
                    else
                    {
                        numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                        lenH = 0;
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                            if (m == 10)
                                ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                        for (int m = 1; m <= numR; m++)
                        {
                            lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                        }
                        for (int m = 1; m <= 10; m++)
                        {
                            lenH += pierPara.pierRebarOld.top_encryption_spacing;
                            //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                            Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                            double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                            List<Point2d> ptVLst = new List<Point2d>();
                            RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                            PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                            PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                            if (m == 1)
                                ptDimT = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                        }
                    }
                }
                else
                {
                    numR = (int)((MH - pierPara.pierRebarOld.bottom_encryption_spacing * 10 - pierPara.pierRebarOld.top_encryption_spacing * 10) / pierPara.pierRebarOld.middle_encryption_spacing);
                    lenH = 0;
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
                        Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                        List<Point2d> ptVLst = new List<Point2d>();
                        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                        PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                        if (m == 10)
                            ptDimB = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                    for (int m = 1; m <= numR; m++)
                    {
                        lenH += pierPara.pierRebarOld.middle_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                        List<Point2d> ptVLst = new List<Point2d>();
                        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                        PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                    }
                    for (int m = 1; m <= 10; m++)
                    {
                        lenH += pierPara.pierRebarOld.top_encryption_spacing;
                        //PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");

                        Point2d ptV1 = ptCM1E.C2D(avg + lenH * pierPara.column.slope_l, lenH);
                        double vL = lenL + FH * pierPara.column.slope_l * 2 + (MH) * (i + 1) * pierPara.column.slope_l * 2 - lenH * pierPara.column.slope_l * 2;
                        List<Point2d> ptVLst = new List<Point2d>();
                        RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                        PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                        PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");

                        if (m == 1)
                            ptDimT = ptCM1E.C3D(avg + lenH * pierPara.column.slope_l, lenH);
                    }
                }
                #endregion


                #region 内轮廓
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);
                ptLst = new List<Point2d>();
                //ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
                //ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
                //Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
                //Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
                ptICM1 = ptTLst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer);
                ptICM2 = ptTLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer);
                Point2d ptICM3 = ptTELst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer);
                Point2d ptICM4 = ptTELst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer);
                Point2d ptICM5 = ptICM3.C2D(mw, -mH);
                Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
                ptLst.Add(ptICM1);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptICM2);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

                #region 隔板
                ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
                PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
                PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");
                #endregion

                ptLst = new List<Point2d>();
                //Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
                //Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * (i + 1));             
                //ptICM3 = ptCF1.C2D(-(HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                //ptICM4 = ptCF2.C2D((HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
                Point2d ptCMI1E = ptBLst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer);
                Point2d ptCMI2E = ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer);
                ptICM3 = ptBSLst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer);
                ptICM4 = ptBSLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer);
                ptICM5 = ptICM3.C2D(mw, mH);
                ptICM6 = ptICM4.C2D(-mw, mH);
                ptLst.Add(ptCMI1E);
                ptLst.Add(ptICM3);
                ptLst.Add(ptICM5);
                ptLst.Add(ptICM6);
                ptLst.Add(ptICM4);
                ptLst.Add(ptCMI2E);
                PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
                #endregion 
            }


            #endregion

            //#region 内轮廓中部


            ////Point2d ptCM1E = ptCF1.C2D(-(MH) * pierPara.column.slope_w, -cap - MH);
            //for (int i = 0; i < BulkheadCount; i++)
            //{
            //    ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i);
            //    ptLst = new List<Point2d>();
            //    ptICM1 = ptCF1.C2D(-(MH) * i * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i);
            //    ptICM2 = ptCF2.C2D((MH) * i * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i);
            //    Point2d ptICM3 = ptCF1.C2D(-(MH * i + HB) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - HB);
            //    Point2d ptICM4 = ptCF2.C2D((MH * i + HB) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - HB);
            //    Point2d ptICM5 = ptICM3.C2D(mw, -mH);
            //    Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
            //    ptLst.Add(ptICM1);
            //    ptLst.Add(ptICM3);
            //    ptLst.Add(ptICM5);
            //    ptLst.Add(ptICM6);
            //    ptLst.Add(ptICM4);
            //    ptLst.Add(ptICM2);
            //    PLPloter.AddPolylineByPointList(ptLst, ref ext, "H虚线", false);

            //    #region 隔板
            //    ptICM = ptBMid.C2D(0, -FH - cap * (i + 1) - MH * i - HB - mH);
            //    PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
            //    PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");


            //    #endregion

            //    ptLst = new List<Point2d>();
            //    Point2d ptCMI1E = ptCF1.C2D(-(MH) * (i + 1) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * (i + 1));
            //    Point2d ptCMI2E = ptCF2.C2D((MH) * (i + 1) * pierPara.column.slope_l - topThickness , -cap * (i + 1) - MH * (i + 1));
            //    //ptICM3 = ptCF1.C2D(-(MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
            //    //ptICM4 = ptCF2.C2D((MH * i + HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
            //    ptICM3 = ptCF1.C2D(-( HB + mH * 2 + bH) * pierPara.column.slope_l + topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
            //    ptICM4 = ptCF2.C2D(( HB + mH * 2 + bH) * pierPara.column.slope_l - topThickness, -cap * (i + 1) - MH * i - (HB + mH * 2 + bH));
            //    ptICM5 = ptICM3.C2D(mw, mH);
            //    ptICM6 = ptICM4.C2D(-mw, mH);
            //    ptLst.Add(ptCMI1E);
            //    ptLst.Add(ptICM3);
            //    ptLst.Add(ptICM5);
            //    ptLst.Add(ptICM6);
            //    ptLst.Add(ptICM4);
            //    ptLst.Add(ptCMI2E);
            //    PLPloter.AddPolylineByPointList(ptLst, ref ext, "H虚线", false);

            //}



            //#endregion

            #region 外轮廓下部

            Point2d ptBottomC = new Point2d(ptBMid.X, ptCM2E.Y - cap - BH);
            double BottomW = pierPara.column.top_l + pierPara.pier_height * 100 * pierPara.column.slope_l;

            Point2d ptCB1E = ptBottomC.C2D(-BottomW * 0.5);
            Point2d ptCB2E = ptBottomC.C2D(BottomW * 0.5);
            Point2d ptCB1 = ptCB1E.C2D(BH * pierPara.column.slope_l, BH);
            Point2d ptCB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l, BH);
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            //PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale), ptCB2.C2D(5 * scale), scale, "H细线");
            PLPloter.CreateBreakLineP(db, ref ext, ptCB1.C2D(-5 * scale, cap), ptCB2.C2D(5 * scale, cap), scale, "H细线");
            PLPloter.AddLine(db,ptCB1, ptCB1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB2, ptCB2E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCB1E, ptCB2E, ref ext, "H细线");

            numR = (int)((BH - pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth) / pierPara.pierRebarOld.bottom_encryption_spacing);
            lenH = 0;
            for (int i = 0; i < numR; i++)
            {
                if (i > 0)
                    lenH += pierPara.pierRebarOld.bottom_encryption_spacing;
                //PLPloter.AddLine(db,ptCB1E.C2D(avg + lenH * pierPara.column.slope_l, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptCB2E.C2D(-avg - lenH * pierPara.column.slope_l, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ref ext, "H钢筋");
                Point2d ptV1 = ptCB1E.C2D(avg + (pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l, lenH + pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth);
                double vL = BottomW - avg * 2 - (pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth + lenH) * pierPara.column.slope_l * 2;
                List<Point2d> ptVLst = new List<Point2d>();
                RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
            }
            #endregion

            #region 内轮廓下部
            ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
            stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
            ptTLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
            ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg + (botH + tH) * pierPara.column.slope_l, botH + tH);
            endL = BottomW - 2 * avg - (botH + tH) * pierPara.column.slope_l * 2;
            ptBLst = new List<Point2d>();
            RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);

            ptLst = new List<Point2d>();
            double BIH = botH + tH;

            //Point2d ptICB1 = ptCB1E.C2D(BH * pierPara.column.slope_l + bottomThickness, BH);
            //Point2d ptICB2 = ptCB2E.C2D(-BH * pierPara.column.slope_l - bottomThickness , BH);
            //Point2d ptICB3 = ptCB1E.C2D(BIH * pierPara.column.slope_l + bottomThickness , BIH);
            //Point2d ptICB4 = ptCB2E.C2D(-BIH * pierPara.column.slope_l - bottomThickness , BIH);


            Point2d ptICB1 = ptTLst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer);
            Point2d ptICB2 = ptTLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer);
            Point2d ptICB3 = ptBLst[spancslLst.Count].C2D(pierPara.pierRebarOld.concrete_protect_layer);
            Point2d ptICB4 = ptBLst[spanclLst.Count - spancslLst.Count].C2D(-pierPara.pierRebarOld.concrete_protect_layer);
            Point2d ptICB5 = ptICB3.C2D(tw, -tH);
            Point2d ptICB6 = ptICB4.C2D(-tw, -tH);
            ptLst.Add(ptICB1);
            ptLst.Add(ptICB3);
            ptLst.Add(ptICB5);
            ptLst.Add(ptICB6);
            ptLst.Add(ptICB4);
            ptLst.Add(ptICB2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);


            List<Point2d> ptBCLst = new List<Point2d>();
            Point2d ptBC = ptBottomC.C2D(-BottomW * 0.5 + (botH - pierPara.pierRebarOld.concrete_protect_layer) * pierPara.column.slope_l + avg, botH - pierPara.pierRebarOld.concrete_protect_layer);
            double endBCL = BottomW - 2 * avg - (botH - pierPara.pierRebarOld.concrete_protect_layer) * pierPara.column.slope_l * 2;
            RebarArrangement.ArrangePoint(ptBC, spancslLst, spancmlLst, lenL, endBCL, out ptBCLst);
            for (int m = 0; m < ptBCLst.Count; m++)
            {
                if (m == spancslLst.Count)
                    PLPloter.AddLine(db,ptBCLst[m], ptBCLst[spanclLst.Count - spancslLst.Count], ref ext, "H钢筋");
            }
            List<Point3d> ptHBLst = new List<Point3d>();
            List<double> ptHBSLst = new List<double>();
            string spBH = "";
            double leB = ptBCLst[spanclLst.Count - spancslLst.Count].X - ptBCLst[spancslLst.Count].X - 2 * radius;
            SteelBarPileCap.CreateAvgCircleHatchList(db, ref ext, ptBCLst[spancslLst.Count].C2D(radius),
               radius, leB, leB, pierPara.pierRebarOld.pier_solid_reinforcement_w_space, 0, radius, out ptHBLst, out ptHSLst, out spBH, eDirection.E_BOTTOM, true);
            PLPloter.AddLine(db,ptBCLst[0], ptBCLst[ptBCLst.Count - 1], ref ext, "H钢筋");

            SteelBarPileCap.CreateRebarPointLine(db, ref ext, eDirection.E_TOP, ptHBLst, "7", ptHBLst.Count / 4, ptHBLst.Count / 4, scale, false, 5 * scale);

            #region 8#，10#

            l1 = new Line(ptICB3.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICB5.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            lenLine = l1.Length;

            p1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 1.4).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenDiv + radius).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);

            ptN8 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), -lenLine * 0.2).C3D();
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptN8, "10", 3 * scale, scale, GeTools.RadianToDegree(ang));
            RebarDimPloter.CreateHookLineMark(db, ref ext, ptALst[ptALst.Count / 2], ptALst, "8", 3 * scale, scale, 360 - GeTools.RadianToDegree(ang));


            l2 = new Line(ptICB4.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), ptICB6.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));
            lenLine2 = l2.Length;

            p1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenLine2 * 1.4).C3D();
            p2 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), -lenLine2 * 0.5).C3D();
            PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            ptALst = new List<Point3d>();
            for (int i = 0; i < spancaLst.Count + 1; i++)
            {
                double lenDiv = (lenLine2 - 2 * radius) * i / spancaLst.Count;
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l2.StartPoint.C2D(), l2.EndPoint.C2D(), lenDiv + radius).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptALst.Add(pp1);
            }
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptALst, scale, 0, false);
            #endregion
            #endregion

            #endregion

            #region 承台外轮廓绘制
            double pileCapW = pierPara.pileCap.pile_cap_length;
            double pileCapH = pierPara.pileCap.pile_cap_height > pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale ? pierPara.pileCap.pile_cap_height : (pierPara.pierRebarOld.pilecap_penetration_depth + 3 * scale);
            ptLst = new List<Point2d>();
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5));
            ptLst.Add(ptBottomC.C2D(-pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5, -pileCapH));
            ptLst.Add(ptBottomC.C2D(pileCapW * 0.5));
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H细线", true);

            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(-pileCapW * 0.5, -pileCapH), ptDim, ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0,-10*scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            #region 钢筋绘制
            total = 0;
            for (int i = 0; i < spanPileCapLst.Count; i++)
            {
                total += spanPileCapLst[spanPileCapLst.Count - 1 - i];
                if (i == spanPileCapLst.Count - 1)
                {
                    ptSt = ptBottomC.C2D(-BottomW * 0.5 + avg + BH * pierPara.column.slope_l, BH);
                    stL = BottomW - 2 * avg - BH * pierPara.column.slope_l * 2;
                    ptTLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptSt, spancslLst, spancmlLst, lenL, stL, out ptTLst);
                    ptEnd = ptBottomC.C2D(-BottomW * 0.5 + avg - pierPara.pierRebarOld.pilecap_penetration_depth * pierPara.column.slope_l, -pierPara.pierRebarOld.pilecap_penetration_depth);
                    endL = BottomW - 2 * avg + pierPara.pierRebarOld.pilecap_penetration_depth * pierPara.column.slope_l * 2;
                    ptBLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptEnd, spancslLst, spancmlLst, lenL, endL, out ptBLst);
                    PLPloter.AddLine(db,ptSt, ptEnd, ref ext, "H钢筋");
                    for (int m = 0; m < ptTLst.Count; m++)
                    {
                        if (m == spancslLst.Count || m == spanclLst.Count - spancslLst.Count || m == spanclLst.Count)
                            PLPloter.AddLine(db,ptTLst[m], ptBLst[m], ref ext, "H钢筋");
                    }

                    DimPloter.DimRot(db, ptBLst[0].C3D(), ptBLst[0].C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                    DimPloter.DimRot(db, ptBottomC.C3D(), ptBLst[0].C3D(0, spanPileCapLst[spanPileCapLst.Count - 1 - i]), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
                }
                else
                {
                    //PLPloter.AddLine(db,ptBottomC.C2D(-BottomW * 0.5 + avg - total * pierPara.column.slope_l, -total), ptBottomC.C2D(BottomW * 0.5 - avg + total * pierPara.column.slope_l, -total), ref ext, "H钢筋");
                    Point2d ptV1 = ptBottomC.C2D(-BottomW * 0.5 + avg - total * pierPara.column.slope_l, -total);
                    double vL = BottomW - 2 * avg - total * pierPara.column.slope_l * 2;
                    List<Point2d> ptVLst = new List<Point2d>();
                    RebarArrangement.ArrangePoint(ptV1, spancslLst, spancmlLst, lenL, vL, out ptVLst);

                    PLPloter.AddLine(db,ptVLst[0].C2D(), ptVLst[spancslLst.Count], ref ext, "H钢筋");
                    PLPloter.AddLine(db,ptVLst[spanclLst.Count - spancslLst.Count].C2D(), ptVLst[spanclLst.Count], ref ext, "H钢筋");
                }
            }

            #endregion

            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptDimT.C3D(), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimT.C3D(-pierPara.column.top_w * 0.5), ptDimB.C3D(pierPara.column.top_w * 0.5, 0), ptDimL.C3D(5 * scale), ref ext, 90, scale, "L-" + pierPara.pierRebarOld.top_encryption_length / pierPara.pierRebarOld.top_encryption_spacing + "×" + pierPara.pierRebarOld.top_encryption_spacing + "-" + pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptDimB.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.bottom_encryption_length / pierPara.pierRebarOld.bottom_encryption_spacing + "×" + pierPara.pierRebarOld.bottom_encryption_spacing, Unit.Centimeter, Unit.Centimeter);
            if (pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth > 0)
                DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.pier_v_reinforcement_pilecap_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(5 * scale), ref ext, 90, scale, pierPara.pierRebarOld.beam_penstration_layout, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBMid.C3D(pierPara.column.top_w * 0.5, pierPara.pierRebarOld.beam_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBMid.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "L", Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pierPara.column.top_w * 0.5), ptBottomC.C3D(pierPara.column.top_w * 0.5, -pierPara.pierRebarOld.pilecap_penetration_depth), ptDimL.C3D(), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            string v = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -pileCapH - 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, ptBottomC.C3D(-pileCapW * 0.5), ptBottomC.C3D(pileCapW * 0.5), ptBottomC.C3D(0, -pileCapH - 10 * scale), ref ext, 0, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);


            #endregion


            List<double> lList = new List<double>();

            for (int i = 0; i < 10; i++)
            {
                lList.Add(pierPara.pierRebarOld.middle_encryption_spacing);
            }
            for (int i = 0; i < 5; i++)
            {
                lList.Add(pierPara.pierRebarOld.bottom_encryption_spacing);
            }
            RebarPLPloter.CreateLineArrowMultDBNew(db, ref ext, ptDimB.C3D(pierPara.column.top_l - bottomThickness * 0.1, 10 * pierPara.pierRebarOld.middle_encryption_spacing), ArrowDirection.South, lList, new List<double>(), "3", "3a", scale, true, 1, 5 * scale);
        }
        #endregion

        #endregion

        #region 墩柱截面
        public void PlotSectionEE(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "E-E", "", scale);
            Point2d pt = insertPoint.C2D(0, -25 * scale);

            //PLPloter.AddPloy4(pt, pierPara.column.top_w * 0.5, pierPara.column.top_w * 0.5, pierPara.column.top_l, ref ext, "H细线");


            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = (pierPara.column.top_l - lenL) * 0.5;
            //if (pierPara.column.slope_w > 0)
            //    W = W + 100;
            //if (pierPara.column.slope_l > 0)
            //    L = L + 100;

            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            //ObjectId pLId2 = PLPloter.CreatPoly8(pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H虚线", innerW, innerL, innerW, innerL);

            //ObjectId pLId3 = PLPloter.CreatPoly8(pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            //List<Point3d> reLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
            //        radius, spancwLst, scale, 0, out reLst, false);
            //List<Point3d> reBLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            // radius, spancwLst, scale, 0, out reBLst, false);

            //List<Point3d> reLLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reLLst, false, false);

            //List<Point3d> reRLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reRLst, false, false);
            double spaceLen = spancsLst.Sum();
            double spaceLLen = spancslLst.Sum();
            List<double> wSPLst = new List<double>();
            string wString = "";
            RebarArrangement.ArrangeSpace(W - avg * 2 - 2 * spaceLen, pierPara.pierRebarOld.pier_solid_reinforcement_w_space, out wSPLst, out wString);

            List<double> lSPLst = new List<double>();
            string lString = "";
            RebarArrangement.ArrangeSpace(L - avgl * 2 - 2 * spaceLen, pierPara.pierRebarOld.pier_solid_reinforcement_l_space, out lSPLst, out lString);
            List<Point3d> reLst1 = new List<Point3d>();
            List<double> lstDimSp = new List<double>();
            SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg + spaceLen, -L + avgl - radius), wSPLst, L - avgl * 2, out reLst1, out lstDimSp, false);
            List<Point3d> reLLst1 = new List<Point3d>();
            List<double> lstDimLSp = new List<double>();
            SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg - radius, -L + avgl + spaceLLen), lSPLst, W - avg * 2, out reLLst1, out lstDimLSp, true);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

            //string v = avg + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_mid_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst1[0], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, reLst1[0], reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, wString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);


            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, -L), reLLst1[0], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, reLLst1[0], reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, lString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);
            //string vl = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter);


            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLLst1[reLLst1.Count - 1].C3D(W * 0.5 + pierPara.pierRebarOld.pier_solid_reinforcement_w_space * 0.5), ArrowDirection.North, lstDimLSp, new List<double>(), "7", scale, true, scale, 0 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLst1[0].C3D(0, L * 0.5 + pierPara.pierRebarOld.pier_solid_reinforcement_l_space * 0.5), ArrowDirection.West, new List<double>(), lstDimSp, "6", scale, true, scale, 0 * scale);
            #region 内部点筋
            //List<Point3d> ptTLst = new List<Point3d>();
            //List<Point3d> ptBLst = new List<Point3d>();

            //List<Point3d> ptLLst = new List<Point3d>();
            //List<Point3d> ptRLst = new List<Point3d>();

            //List<Point3d> ptLTLst = new List<Point3d>();
            //List<Point3d> ptRTLst = new List<Point3d>();
            //List<Point3d> ptLBLst = new List<Point3d>();
            //List<Point3d> ptRBLst = new List<Point3d>();

            //double ang = Math.Atan(innerW / innerL);
            //using (Transaction tr = db.TransactionManager.StartTransaction())
            //{
            //    BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
            //    LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
            //    BlockTableRecord modelSpace;
            //    modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
            //    Polyline PL1 = tr.GetObject(pLId2, OpenMode.ForRead) as Polyline;
            //    Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
            //    LineSegment2d li = PL.GetLineSegment2dAt(0);
            //    Line line1 = PL.GetLineSegment2dAt(0).CLine();
            //    Line line2 = PL.GetLineSegment2dAt(2).CLine();
            //    Line line3 = PL.GetLineSegment2dAt(4).CLine();
            //    Line line4 = PL.GetLineSegment2dAt(6).CLine();

            //    LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
            //    LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

            //    int stIndex = 0;
            //    int endIndex = 0;
            //    int stlIndex = 0;
            //    int endlIndex = 0;
            //    Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
            //    Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
            //    Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
            //    Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

            //    for (int i = 0; i < reLst.Count; i++)
            //    {
            //        if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
            //        {
            //            ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
            //            ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
            //        }
            //    }

            //    for (int i = 0; i < reLLst.Count; i++)
            //    {
            //        if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
            //        {
            //            ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
            //            ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
            //        }
            //    }

            //    LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

            //    Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

            //    double lenLine = l1.Length;
            //    Point3d p1 = MathExtensions.GetIntersection(l1, line1);
            //    Point3d p2 = MathExtensions.GetIntersection(l1, line2);
            //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            //    Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
            //    Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
            //    ptRTLst.Add(pp1);
            //    ptRTLst.Add(pp2);

            //    LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
            //    Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

            //    p1 = MathExtensions.GetIntersection(l3, line2);
            //    p2 = MathExtensions.GetIntersection(l3, line3);
            //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            //    pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
            //    pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
            //    ptRBLst.Add(pp1);
            //    ptRBLst.Add(pp2);

            //    LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
            //    Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

            //    p1 = MathExtensions.GetIntersection(l5, line3);
            //    p2 = MathExtensions.GetIntersection(l5, line4);
            //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            //    pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
            //    pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
            //    ptLBLst.Add(pp1);
            //    ptLBLst.Add(pp2);

            //    LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
            //    Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

            //    p1 = MathExtensions.GetIntersection(l7, line1);
            //    p2 = MathExtensions.GetIntersection(l7, line4);
            //    PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
            //    pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
            //    pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
            //    ptLTLst.Add(pp1);
            //    ptLTLst.Add(pp2);
            //    tr.Commit();
            //}

            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            //SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);
            #endregion


        }


        public void PlotSectionFF(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "F-F", "", scale);
            Point2d pt = insertPoint.C2D(0, -25 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            //if (pierPara.column.slope_w > 0)
            //    W = W + 100;
            if (pierPara.column.slope_l > 0)
                L = L + 30;

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = (pierPara.column.top_l - lenL) * 0.5;


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            ObjectId pLId2 = PLPloter.CreatPoly8(db, pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            ObjectId pLId3 = PLPloter.CreatPoly8(db, pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            List<Point3d> reLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                    radius, spancwLst, scale, 0, out reLst, false);
            List<Point3d> reBLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
             radius, spancwLst, scale, 0, out reBLst, false);

            //List<Point3d> reLLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reLLst, false, false);

            //List<Point3d> reRLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            //radius, spanclLst, scale, 0, out reRLst, false, false);
            double vL = L - 2 * avg;
            List<double> vLst = new List<double>();
            string dimC = "C";
            RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, 1);
            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            radius, vLst, scale, 0, out reLLst, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            radius, vLst, scale, 0, out reRLst, false, false);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");


            string v = avg + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_mid_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //string vl = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            string vl = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + "C" + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + "C" + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);

            #region 内部点筋
            List<Point3d> ptTLst = new List<Point3d>();
            List<Point3d> ptBLst = new List<Point3d>();

            List<Point3d> ptLLst = new List<Point3d>();
            List<Point3d> ptRLst = new List<Point3d>();

            List<Point3d> ptLTLst = new List<Point3d>();
            List<Point3d> ptRTLst = new List<Point3d>();
            List<Point3d> ptLBLst = new List<Point3d>();
            List<Point3d> ptRBLst = new List<Point3d>();

            double ang = Math.Atan(innerW / innerL);
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                BlockTableRecord modelSpace;
                modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                Polyline PL1 = tr.GetObject(pLId2, OpenMode.ForRead) as Polyline;
                Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
                LineSegment2d li = PL.GetLineSegment2dAt(0);
                Line line1 = PL.GetLineSegment2dAt(0).CLine();
                Line line2 = PL.GetLineSegment2dAt(2).CLine();
                Line line3 = PL.GetLineSegment2dAt(4).CLine();
                Line line4 = PL.GetLineSegment2dAt(6).CLine();

                LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
                LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

                int stIndex = 0;
                int endIndex = 0;
                int stlIndex = 0;
                int endlIndex = 0;
                Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
                Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
                Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
                Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

                for (int i = 0; i < reLst.Count; i++)
                {
                    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                    {
                        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
                    }
                }

                for (int i = 0; i < reLLst.Count; i++)
                {
                    if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
                    {
                        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
                    }
                }

                LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

                Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                double lenLine = l1.Length;
                Point3d p1 = MathExtensions.GetIntersection(l1, line1);
                Point3d p2 = MathExtensions.GetIntersection(l1, line2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptRTLst.Add(pp1);
                ptRTLst.Add(pp2);

                LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
                Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l3, line2);
                p2 = MathExtensions.GetIntersection(l3, line3);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptRBLst.Add(pp1);
                ptRBLst.Add(pp2);

                LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
                Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l5, line3);
                p2 = MathExtensions.GetIntersection(l5, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptLBLst.Add(pp1);
                ptLBLst.Add(pp2);

                LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
                Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l7, line1);
                p2 = MathExtensions.GetIntersection(l7, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptLTLst.Add(pp1);
                ptLTLst.Add(pp2);
                Point3d ptN5 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN5, "5", 3 * scale, scale, 315);
                tr.Commit();
            }

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);

            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "1", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 4.5 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, reBLst, "1", ptBLst.Count / 15, ptBLst.Count / 10, scale, false, 4.5 * scale);


            List<Point3d> listN1T = new List<Point3d>();
            List<Point3d> listN1M = new List<Point3d>();
            List<Point3d> listN1B = new List<Point3d>();
            List<Point3d> listN2T = new List<Point3d>();
            List<Point3d> listN2B = new List<Point3d>();
            for (int i = 0; i < reRLst.Count; i++)
            {
                if (i <= spancslLst.Count)
                    listN1T.Add(reRLst[i]);
                else if (i > spancslLst.Count && i <= spancslLst.Count + spancmlLst.Count + 1)
                    listN1M.Add(reRLst[i]);
                else
                    listN1B.Add(reRLst[i]);
            }

            SteelBarPileCap.CreateLineList(db, ref ext, listN1T, eDirection.E_RIGHT, 5 * scale, "H细线");
            Point3d pttxt = GeTools.MidPoint(listN1T[0], listN1T[listN1T.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1M, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1M[0], listN1M[listN1M.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1B[0], listN1B[listN1B.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);

            //SteelBarPileCap.CreateLineList(db, ref ext, listN2T, eDirection.E_RIGHT, 5 * scale, "H细线");
            //pttxt = GeTools.MidPoint(listN2T[0], listN2T[listN2T.Count - 1]);
            //TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            //SteelBarPileCap.CreateLineList(db, ref ext, listN2B, eDirection.E_RIGHT, 5 * scale, "H细线");
            //pttxt = GeTools.MidPoint(listN2B[0], listN2B[listN2B.Count - 1]);
            //TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            #endregion



            #region  箍筋
            List<double> lstLenWSList = new List<double>();
            List<double> lstLenLSList = new List<double>();
            int num = spancmLst.Count / pierPara.pierRebarOld.stirrup_count;
            if (spancmLst.Count % pierPara.pierRebarOld.stirrup_count >= pierPara.pierRebarOld.stirrup_count * 0.25)
            {
                num = num + 1;
            }
            List<double> lst = new List<double>();
            int neA = (int)((pierPara.pierRebarOld.stirrup_count * num - spancmLst.Count) * 0.5);
            if (neA > 0)
            {
                for (int i = neA; i > 0; i--)
                {
                    lst.Add(spancaLst[spancaLst.Count - neA]);
                }
                for (int i = 0; i < spancmLst.Count; i++)
                {
                    lst.Add(spancmLst[spancmLst.Count - neA]);
                }
                for (int i = neA; i > 0; i--)
                {
                    lst.Add(spancaLst[spancaLst.Count - neA]);
                }
            }
            else
                lst = spancmLst;
            double wlen = lst.Sum() + 2 * radius;
            double les = 0;
            double les0 = 0;
            Point2d ptS = pt.C2D(-wlen * 0.5, -avgl + radius);
            Point2d ptBS = pt.C2D(-wlen * 0.5, -L + avgl - radius + sl + radius * 2);
            for (int i = 0; i < lst.Count; i++)
            {
                les0 += lst[i];
                les += lst[i];
                if ((i + 1) % pierPara.pierRebarOld.stirrup_count == 0)
                {
                    PLPloter.AddPloy4(db, ptS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
                    PLPloter.AddPloy4(db, ptBS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
                    lstLenWSList.Add(les);
                    les = 0;
                }
            }

            int numl = spancmlLst.Count / pierPara.pierRebarOld.stirrup_count;
            if (spancmlLst.Count % pierPara.pierRebarOld.stirrup_count > 0)
            {
                numl = numl + 1;
            }
            List<double> lLst = new List<double>();
            int neLA = (int)((pierPara.pierRebarOld.stirrup_count * numl - spancmlLst.Count) * 0.5);
            if (neLA > 0)
            {
                for (int i = neLA; i > 0; i--)
                {
                    lLst.Add(spancslLst[spancslLst.Count - neLA]);
                }
                for (int i = 0; i < spancmlLst.Count; i++)
                {
                    lLst.Add(spancmlLst[i]);
                }
                for (int i = neLA; i > 0; i--)
                {
                    lLst.Add(spancslLst[spancslLst.Count - neLA]);
                }
            }
            else
                lLst = spancmlLst;
            double wLlen = lLst.Sum();
            les = 0;
            les0 = 0;
            Point2d ptS1 = pt.C2D(-pierPara.column.top_w * 0.5 + avg + sw * 0.5, -(L - wLlen) * 0.5 + radius);
            Point2d ptBS1 = pt.C2D(pierPara.column.top_w * 0.5 - avg - sw * 0.5, -(L - wLlen) * 0.5 + radius);
            int div = 0;
            bool isAdd = false;
            for (int i = 0; i < lLst.Count; i++)
            {
                les0 += lLst[i];
                les += lLst[i];
                if (lLst.Count % pierPara.pierRebarOld.stirrup_count == 0)
                {
                    if ((i + 1) % pierPara.pierRebarOld.stirrup_count == 0)
                    {
                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        lstLenLSList.Add(les);
                        les = 0;
                    }
                }
                else
                {
                    int nu = lLst.Count - pierPara.pierRebarOld.stirrup_count * (numl - 2);
                    int count = nu / 2;
                    int add = nu - count * 2;

                    if ((i + 1) == count)
                    {
                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        lstLenLSList.Add(les);
                        les = 0;
                        div++;
                    }
                    else
                    {
                        if (div > 0)
                        {
                            if (!isAdd)
                            {
                                if (div == (int)(numl * 0.5))
                                {
                                    if (((i + 1) - count) % (pierPara.pierRebarOld.stirrup_count + add) == 0)
                                    {
                                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        lstLenLSList.Add(les);
                                        les = 0;
                                        isAdd = true;
                                    }
                                }
                                else
                                {
                                    if (((i + 1) - count) % pierPara.pierRebarOld.stirrup_count == 0)
                                    {
                                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        lstLenLSList.Add(les);
                                        les = 0;
                                    }
                                }
                            }
                            else
                            {


                                if (((i + 1) - count - add) % pierPara.pierRebarOld.stirrup_count == 0)
                                {
                                    PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                    PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                    lstLenLSList.Add(les);
                                    les = 0;
                                }
                                else
                                {
                                    if ((i) == lLst.Count - 1)
                                    {
                                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        lstLenLSList.Add(les);
                                        les = 0;
                                        div++;
                                    }
                                }


                            }
                        }
                    }
                }

            }
            #endregion

            List<double> lList = new List<double>();
            lList.Add(sl + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.1 + 5, -L + avgl + sl + radius), ArrowDirection.North, lList, new List<double>(), "3", scale, true, 5, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.5 - avg - sw - radius, -L * 0.3 - 5), ArrowDirection.West, new List<double>(), lList, "4", scale, true, 7, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBS1.C3D(0, 0), ArrowDirection.North, lstLenLSList, new List<double>(), "4a", "4b", scale, false, 15, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptS.C3D(0, -sl * 0.5), ArrowDirection.West, new List<double>(), lstLenWSList, "3a", "3b", scale, false, 18, 0);
        }

        public void PlotSectionGG(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "G-G", "", scale);
            Point2d pt = insertPoint.C2D(0, -25 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            if (pierPara.column.slope_w > 0)
                W = W + 120;
            if (pierPara.column.slope_l > 0)
                L = L + 120;

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = (pierPara.column.top_l - lenL) * 0.5;


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            ObjectId pLId2 = PLPloter.CreatPoly8(db, pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            ObjectId pLId3 = PLPloter.CreatPoly8(db, pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            List<Point3d> reLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
                    radius, spancwLst, scale, 0, out reLst, false);
            List<Point3d> reBLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
             radius, spancwLst, scale, 0, out reBLst, false);





            double vL = L - 2 * avg;
            List<double> vLst = new List<double>();
            string dimC = pierPara.pierRebarOld.main_l_change_num + "×C";
            double spChange = (vL - lenL) / (pierPara.pierRebarOld.main_l_change_num * 2);
            RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, pierPara.pierRebarOld.main_l_change_num);
            List<Point3d> reLLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            radius, vLst, scale, 0, out reLLst, false, false);
            List<Point3d> reRLst = new List<Point3d>();
            SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            radius, vLst, scale, 0, out reRLst, false, false);

            double sw = spancsLst.Sum();
            double sl = spancslLst.Sum();
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");


            string v = avg + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_mid_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            string vl = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);

            #region 内部点筋
            List<Point3d> ptTLst = new List<Point3d>();
            List<Point3d> ptBLst = new List<Point3d>();

            List<Point3d> ptLLst = new List<Point3d>();
            List<Point3d> ptRLst = new List<Point3d>();

            List<Point3d> ptLTLst = new List<Point3d>();
            List<Point3d> ptRTLst = new List<Point3d>();
            List<Point3d> ptLBLst = new List<Point3d>();
            List<Point3d> ptRBLst = new List<Point3d>();

            double ang = Math.Atan(innerW / innerL);
            using (Transaction tr = db.TransactionManager.StartTransaction())
            {
                BlockTable blockTbl = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
                LayerTable lt = tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                BlockTableRecord modelSpace;
                modelSpace = tr.GetObject(blockTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
                Polyline PL1 = tr.GetObject(pLId2, OpenMode.ForRead) as Polyline;
                Polyline PL = tr.GetObject(pLId3, OpenMode.ForRead) as Polyline;
                LineSegment2d li = PL.GetLineSegment2dAt(0);
                Line line1 = PL.GetLineSegment2dAt(0).CLine();
                Line line2 = PL.GetLineSegment2dAt(2).CLine();
                Line line3 = PL.GetLineSegment2dAt(4).CLine();
                Line line4 = PL.GetLineSegment2dAt(6).CLine();

                LineSegment2d li0 = PL1.GetLineSegment2dAt(0);
                LineSegment2d li2 = PL1.GetLineSegment2dAt(2);

                int stIndex = 0;
                int endIndex = 0;
                int stlIndex = 0;
                int endlIndex = 0;
                Point2d pt1 = pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius);
                Point2d pt2 = pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius);
                Point2d pt3 = pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius);
                Point2d pt4 = pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius);

                for (int i = 0; i < reLst.Count; i++)
                {
                    if (reLst[i].X >= li0.StartPoint.X && reLst[i].X <= li0.EndPoint.X)
                    {
                        ptTLst.Add(new Point3d(reLst[i].X, pt3.Y + radius, 0));
                        ptBLst.Add(new Point3d(reLst[i].X, pt4.Y - radius, 0));
                    }
                }

                for (int i = 0; i < reLLst.Count; i++)
                {
                    if (reLLst[i].Y <= li2.StartPoint.Y && reLLst[i].Y >= li2.EndPoint.Y)
                    {
                        ptLLst.Add(new Point3d(pt1.X - radius, reLLst[i].Y, 0));
                        ptRLst.Add(new Point3d(pt2.X + radius, reLLst[i].Y, 0));
                    }
                }

                LineSegment2d li1 = PL1.GetLineSegment2dAt(1);

                Line l1 = new Line(li1.StartPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li1.EndPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                double lenLine = l1.Length;
                Point3d p1 = MathExtensions.GetIntersection(l1, line1);
                Point3d p2 = MathExtensions.GetIntersection(l1, line2);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                Point3d pp1 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                Point3d pp2 = MathExtensions.GetPointOnTheLine(l1.StartPoint.C2D(), l1.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptRTLst.Add(pp1);
                ptRTLst.Add(pp2);

                LineSegment2d li3 = PL1.GetLineSegment2dAt(3);
                Line l3 = new Line(li3.StartPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li3.EndPoint.C3D(pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l3, line2);
                p2 = MathExtensions.GetIntersection(l3, line3);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l3.StartPoint.C2D(), l3.EndPoint.C2D(), lenLine * 2 / 3).C3D(radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptRBLst.Add(pp1);
                ptRBLst.Add(pp2);

                LineSegment2d li5 = PL1.GetLineSegment2dAt(5);
                Line l5 = new Line(li5.StartPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li5.EndPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), -pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l5, line3);
                p2 = MathExtensions.GetIntersection(l5, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l5.StartPoint.C2D(), l5.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), -radius * Math.Sin(ang));
                ptLBLst.Add(pp1);
                ptLBLst.Add(pp2);

                LineSegment2d li7 = PL1.GetLineSegment2dAt(7);
                Line l7 = new Line(li7.StartPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)), li7.EndPoint.C3D(-pierPara.pierRebarOld.concrete_protect_layer * Math.Cos(ang), pierPara.pierRebarOld.concrete_protect_layer * Math.Sin(ang)));

                p1 = MathExtensions.GetIntersection(l7, line1);
                p2 = MathExtensions.GetIntersection(l7, line4);
                PLPloter.AddLine(db,p1.C2D(), p2.C2D(), ref ext, "H钢筋");
                pp1 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                pp2 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine * 2 / 3).C3D(-radius * Math.Cos(ang), radius * Math.Sin(ang));
                ptLTLst.Add(pp1);
                ptLTLst.Add(pp2);

                Point3d ptN5 = MathExtensions.GetPointOnTheLine(l7.StartPoint.C2D(), l7.EndPoint.C2D(), lenLine / 2).C3D();
                RebarDimPloter.CreateHookLineMark(db, ref ext, ptN5, "5", 3 * scale, scale, 315);
                tr.Commit();
            }

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptBLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRLst, scale, 0, false);

            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptRBLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLTLst, scale, 0, false);
            SteelBarPileCap.CreateSingleBatchHatchByPointList(db, ref ext, radius, ptLBLst, scale, 0, false);

            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_BOTTOM, ptBLst, "1", ptBLst.Count / 10, ptBLst.Count / 10, scale, false, 4.5 * scale);
            SteelBarPileCap.CreateRebarPointLineNew(db, ref ext, eDirection.E_TOP, reBLst, "1", ptBLst.Count / 10, ptBLst.Count / 10, scale, false, 4.5 * scale);

            List<Point3d> listN1T = new List<Point3d>();
            List<Point3d> listN1M = new List<Point3d>();
            List<Point3d> listN1B = new List<Point3d>();
            List<Point3d> listN2T = new List<Point3d>();
            List<Point3d> listN2B = new List<Point3d>();
            for (int i = 0; i < reRLst.Count; i++)
            {
                if (i <= spancslLst.Count)
                    listN1T.Add(reRLst[i]);
                else if (i > spancslLst.Count && i < spancslLst.Count + pierPara.pierRebarOld.main_l_change_num)
                    listN2T.Add(reRLst[i]);
                else if (i >= spancslLst.Count + pierPara.pierRebarOld.main_l_change_num && i < spancslLst.Count + pierPara.pierRebarOld.main_l_change_num + spancmlLst.Count)
                    listN1M.Add(reRLst[i]);
                else if (i >= spancslLst.Count + pierPara.pierRebarOld.main_l_change_num + spancmlLst.Count && i < reRLst.Count - 1 - spancslLst.Count)
                    listN2B.Add(reRLst[i]);
                else
                    listN1B.Add(reRLst[i]);
            }

            SteelBarPileCap.CreateLineList(db, ref ext, listN1T, eDirection.E_RIGHT, 5 * scale, "H细线");
            Point3d pttxt = GeTools.MidPoint(listN1T[0], listN1T[listN1T.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1M, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1M[0], listN1M[listN1M.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN1B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN1B[0], listN1B[listN1B.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "1", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);

            SteelBarPileCap.CreateLineList(db, ref ext, listN2T, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN2T[0], listN2T[listN2T.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            SteelBarPileCap.CreateLineList(db, ref ext, listN2B, eDirection.E_RIGHT, 5 * scale, "H细线");
            pttxt = GeTools.MidPoint(listN2B[0], listN2B[listN2B.Count - 1]);
            TextPloter.AddDBText(db,pttxt.C3D(5 * scale + 1.5 * scale, 0), ref ext, "2", scale, 2, "SRB.HT", 0, TextHorizontalMode.TextMid, TextVerticalMode.TextVerticalMid);
            #endregion

            #region  箍筋
            List<double> lstLenWSList = new List<double>();
            List<double> lstLenLSList = new List<double>();
            int num = spancmLst.Count / pierPara.pierRebarOld.stirrup_count;
            if (spancmLst.Count % pierPara.pierRebarOld.stirrup_count >= pierPara.pierRebarOld.stirrup_count * 0.25)
            {
                num = num + 1;
            }
            List<double> lst = new List<double>();
            int neA = (int)((pierPara.pierRebarOld.stirrup_count * num - spancmLst.Count) * 0.5);
            if (neA > 0)
            {
                for (int i = neA; i > 0; i--)
                {
                    lst.Add(spancaLst[spancaLst.Count - neA]);
                }
                for (int i = 0; i < spancmLst.Count; i++)
                {
                    lst.Add(spancmLst[spancmLst.Count - neA]);
                }
                for (int i = neA; i > 0; i--)
                {
                    lst.Add(spancaLst[spancaLst.Count - neA]);
                }
            }
            else
                lst = spancmLst;
            double wlen = lst.Sum() + 2 * radius;
            double les = 0;
            double les0 = 0;
            Point2d ptS = pt.C2D(-wlen * 0.5, -avgl + radius);
            Point2d ptBS = pt.C2D(-wlen * 0.5, -L + avgl - radius + sl + radius * 2);
            for (int i = 0; i < lst.Count; i++)
            {
                les0 += lst[i];
                les += lst[i];
                if ((i + 1) % pierPara.pierRebarOld.stirrup_count == pierPara.pierRebarOld.stirrup_count - 1)
                {
                    PLPloter.AddPloy4(db, ptS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
                    PLPloter.AddPloy4(db, ptBS.C2D(les0 - les + les * 0.5 + radius), les * 0.5 + radius, les * 0.5 + radius, sl + radius * 2, ref ext, "H钢筋");
                    lstLenWSList.Add(les);
                    les = 0;
                }
            }

            int numl = spancmlLst.Count / pierPara.pierRebarOld.stirrup_count;
            if (spancmlLst.Count % pierPara.pierRebarOld.stirrup_count >= pierPara.pierRebarOld.stirrup_count * 0.25)
            {
                numl = numl + 1;
            }
            //if (pierPara.pierRebarOld.main_l_change_num != 0)
            //{
            //    numl = (spancmlLst.Count + pierPara.pierRebarOld.main_l_change_num * 2) / pierPara.pierRebarOld.stirrup_count;
            //}
            List<double> lLst = new List<double>();
            int neLA = (int)((pierPara.pierRebarOld.stirrup_count * numl - spancmlLst.Count) * 0.5);
            if (neLA > 0)
            {
                if (pierPara.pierRebarOld.main_l_change_num == 0)
                {
                    for (int i = neLA; i > 0; i--)
                    {
                        lLst.Add(spancslLst[spancslLst.Count - neLA]);
                    }
                    for (int i = 0; i < spancmlLst.Count; i++)
                    {
                        lLst.Add(spancmlLst[i]);
                    }
                    for (int i = neLA; i > 0; i--)
                    {
                        lLst.Add(spancslLst[spancslLst.Count - neLA]);
                    }
                }
                else
                {

                    neLA = (int)((pierPara.pierRebarOld.stirrup_count * numl - spancmlLst.Count) * 0.5);
                    for (int i = neLA; i > 0; i--)
                    {
                        lLst.Add(spChange);
                    }
                    for (int i = 0; i < spancmlLst.Count; i++)
                    {
                        lLst.Add(spancmlLst[i]);
                    }
                    for (int i = neLA; i > 0; i--)
                    {
                        lLst.Add(spChange);
                    }
                }
            }
            else
                lLst = spancmlLst;
            double wLlen = lLst.Sum();
            les = 0;
            les0 = 0;
            Point2d ptS1 = pt.C2D(-pierPara.column.top_w * 0.5 + avg + sw * 0.5, -(L - wLlen) * 0.5);
            Point2d ptBS1 = pt.C2D(pierPara.column.top_w * 0.5 - avg - sw * 0.5, -(L - wLlen) * 0.5);
            //for (int i = 0; i < lLst.Count; i++)
            //{
            //    les0 += lLst[i];
            //    les += lLst[i];
            //    if ((i+1) % pierPara.pierRebarOld.stirrup_count == pierPara.pierRebarOld.stirrup_count - 1)
            //    {
            //        PLPloter.AddPloy4(ptS.C2D(0, -(les0 - les ) + radius), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //        PLPloter.AddPloy4(ptBS.C2D(0, -(les0 -les) + radius), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
            //        les = 0;
            //    }
            //}
            int div = 0;
            bool isAdd = false;
            for (int i = 0; i < lLst.Count; i++)
            {
                les0 += lLst[i];
                les += lLst[i];
                if (lLst.Count % pierPara.pierRebarOld.stirrup_count == 0)
                {
                    if ((i + 1) % pierPara.pierRebarOld.stirrup_count == 0)
                    {
                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les - radius)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        lstLenLSList.Add(les);
                        les = 0;
                    }
                }
                else
                {
                    int nu = lLst.Count - pierPara.pierRebarOld.stirrup_count * (numl - 2);
                    int count = nu / 2;
                    int add = nu - count * 2;

                    if ((i + 1) == count)
                    {
                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                        lstLenLSList.Add(les);
                        les = 0;
                        div++;
                    }
                    else
                    {
                        if (div > 0)
                        {
                            if (!isAdd)
                            {
                                if (div == (int)(numl * 0.5))
                                {
                                    if (((i + 1) - count) % (pierPara.pierRebarOld.stirrup_count + add) == 0)
                                    {
                                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        lstLenLSList.Add(les);
                                        les = 0;
                                        isAdd = true;
                                    }
                                }
                                else
                                {
                                    if (((i + 1) - count) % pierPara.pierRebarOld.stirrup_count == 0)
                                    {
                                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        lstLenLSList.Add(les);
                                        les = 0;
                                    }
                                }
                            }
                            else
                            {


                                if (((i + 1) - count - add) % pierPara.pierRebarOld.stirrup_count == 0)
                                {
                                    PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                    PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                    lstLenLSList.Add(les);
                                    les = 0;
                                }
                                else
                                {
                                    if ((i) == lLst.Count - 1)
                                    {
                                        PLPloter.AddPloy4(db, ptS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        PLPloter.AddPloy4(db, ptBS1.C2D(0, -(les0 - les)), sw * 0.5 + radius, sw * 0.5 + radius, les + radius * 2, ref ext, "H钢筋");
                                        lstLenLSList.Add(les);
                                        les = 0;
                                        div++;
                                    }
                                }


                            }
                        }
                    }
                }

            }
            #endregion

            List<double> lList = new List<double>();
            lList.Add(sl + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.1 + 5, -L + avgl + sl + radius), ArrowDirection.North, lList, new List<double>(), "3", scale, true, 5, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, pt.C3D(pierPara.column.top_w * 0.5 - avg - sw - radius, -L * 0.45 - 5), ArrowDirection.West, new List<double>(), lList, "4", scale, true, 7, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptBS1.C3D(0, 0), ArrowDirection.North, lstLenLSList, new List<double>(), "4a", "4b", scale, false, 15, 0);

            lList = new List<double>();
            lList.Add(sw + radius * 2);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, ptS.C3D(0, -sl * 0.5), ArrowDirection.West, new List<double>(), lstLenWSList, "3a", "3b", scale, false, 18, 0);
        }

        public void PlotSectionHH(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "H-H", "", scale);
            Point2d pt = insertPoint.C2D(0, -25 * scale);

            double W = pierPara.column.top_w;
            double L = pierPara.column.top_l;
            if (pierPara.column.slope_w > 0)
                W = W + 120;
            if (pierPara.column.slope_l > 0)
                L = L + 120;

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            double lenL = Math.Round(spanclLst.Sum(), 1);
            double avgl = (pierPara.column.top_l - lenL) * 0.5;


            string[] sizeOut = pierPara.column.out_section_ang.Split('*');
            string[] sizeInner = pierPara.column.inner_section_ang.Split('*');
            double outW = double.Parse(sizeOut[0]);
            double outL = double.Parse(sizeOut[1]);
            double innerW = double.Parse(sizeInner[0]);
            double innerL = double.Parse(sizeInner[1]);
            ObjectId pLId1 = PLPloter.CreatPoly8(db, pt.C2D(), ref ext, L, W, "H细线", outL, outW, outL, outW);

            //ObjectId pLId2 = PLPloter.CreatPoly8(pt.C2D(0, -topThickness), ref ext, L - 2 * topThickness, W - 2 * topThickness, "H细线", innerW, innerL, innerW, innerL);

            //PLPloter.CreatPoly8(pt.C2D(0, -avg + radius), ref ext, L - avg * 2 + radius * 2, W - avg * 2 + radius * 2, "H钢筋", outL, outW, outL, outW);

            //List<Point3d> reLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -avgl),
            //        radius, spancwLst, scale, 0, out reLst, false);
            //List<Point3d> reBLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            // radius, spancwLst, scale, 0, out reBLst, false);

            //double vL = L - 2 * avg;
            //List<double> vLst = new List<double>();
            //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, pierPara.pierRebarOld.main_l_change_num);

            //List<Point3d> reLLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(-W * 0.5 + avg, -L + avgl),
            //radius, vLst, scale, 0, out reLLst, false, false);
            //List<Point3d> reRLst = new List<Point3d>();
            //SteelBarPileCap.CreateSingleBathchHatch(db, ref ext, pt.C2D(W * 0.5 - avg, -L + avgl),
            //radius, vLst, scale, 0, out reRLst, false, false);

            //double sw = spancsLst.Sum();
            //double sl = spancslLst.Sum();
            //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg + sw + radius, -avgl + radius), pt.C2D(-W * 0.5 + avg + sw + radius, -L + avgl - radius), ref ext, "H钢筋");
            //PLPloter.AddLine(db,pt.C2D(W * 0.5 - avg - sw - radius, -avgl + radius), pt.C2D(W * 0.5 - avg - sw - radius, -L + avgl - radius), ref ext, "H钢筋");
            //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -avgl - sl - radius), pt.C2D(W * 0.5 - avg + radius, -avgl - sl - radius), ref ext, "H钢筋");
            //PLPloter.AddLine(db,pt.C2D(-W * 0.5 + avg - radius, -L + avgl + sl + radius), pt.C2D(W * 0.5 - avg + radius, -L + avgl + sl + radius), ref ext, "H钢筋");

            //double vL = L - 2 * avg;
            //List<double> vLst = new List<double>();
            //RebarArrangement.ArrangeSpan(spancslLst, spancmlLst, lenL, vL, out vLst, pierPara.pierRebarOld.main_l_change_num);
            //List<Point3d> reLst1 = new List<Point3d>();
            //SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg + radius, -L + avgl - radius), spancwLst, L - avgl * 2 + radius * 2, out reLst1, false);
            //List<Point3d> reLLst1 = new List<Point3d>();
            //SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg - radius, -L + avgl - radius), vLst, W - avg * 2 + radius * 2, out reLLst1, true);


            //string v = avg + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_mid_layout + "+" + pierPara.pierRebarOld.main_w_angle_layout + "+" + pierPara.pierRebarOld.main_w_thickness_layout + "+" + avg;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 5 * scale), ref ext, 0, scale, v, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);

            //string vl = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_change_num + "*C" + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, 0), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, vl, Unit.Centimeter, Unit.Centimeter);
            //DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(-pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);

            double spaceLen = spancsLst.Sum();
            double spaceLLen = spancslLst.Sum();
            List<double> wSPLst = new List<double>();
            string wString = "";
            RebarArrangement.ArrangeSpace(W - avg * 2 - 2 * spaceLen, pierPara.pierRebarOld.pier_solid_reinforcement_w_space, out wSPLst, out wString);

            List<double> lSPLst = new List<double>();
            string lString = "";
            RebarArrangement.ArrangeSpace(L - avgl * 2 - 2 * spaceLen, pierPara.pierRebarOld.pier_solid_reinforcement_l_space, out lSPLst, out lString);
            List<Point3d> reLst1 = new List<Point3d>();
            List<double> lstDimSp = new List<double>();
            SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg + spaceLen, -L + avgl - radius), wSPLst, L - avgl * 2, out reLst1, out lstDimSp, false);
            List<Point3d> reLLst1 = new List<Point3d>();
            List<double> lstDimLSp = new List<double>();
            SteelBarPileCap.CreateBatchLine(db, ref ext, pt.C2D(-W * 0.5 + avg - radius, -L + avgl + spaceLLen), lSPLst, W - avg * 2, out reLLst1, out lstDimLSp, true);

            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), reLst1[0], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, reLst1[0], reLst1[reLst1.Count - 1], pt.C3D(0, 5 * scale), ref ext, 0, scale, wString, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5), pt.C3D(0, 10 * scale), ref ext, 0, scale, "", Unit.Centimeter, Unit.Centimeter);


            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5, -L), reLLst1[0], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, pt.C3D(pierPara.column.top_w * 0.5), reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "", Unit.Centimeter, Unit.Centimeter, 1);
            DimPloter.DimRot(db, reLLst1[0], reLLst1[reLLst1.Count - 1], pt.C3D(-pierPara.column.top_w * 0.5 - 5 * scale), ref ext, 90, scale, "n1×" + pierPara.pierRebarOld.pier_solid_reinforcement_l_space, Unit.Centimeter, Unit.Centimeter);
            DimPloter.DimRot(db, pt.C3D(-pierPara.column.top_w * 0.5), pt.C3D(pierPara.column.top_w * 0.5, -L), pt.C3D(-pierPara.column.top_w * 0.5 - 10 * scale), ref ext, 90, scale, "Bdi", Unit.Centimeter, Unit.Centimeter);
            //string vl = avg + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + pierPara.pierRebarOld.main_l_mid_layout + "+" + pierPara.pierRebarOld.main_l_thickness_layout + "+" + avg;


            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLLst1[reLLst1.Count - 1].C3D(W * 0.5 + pierPara.pierRebarOld.pier_solid_reinforcement_w_space * 0.5), ArrowDirection.North, lstDimLSp, new List<double>(), "7", scale, true, scale, 0 * scale);
            RebarPLPloter.CreateLineArrowDBNew(db, ref ext, reLst1[0].C3D(0, L * 0.5 + pierPara.pierRebarOld.pier_solid_reinforcement_l_space * 0.5), ArrowDirection.West, new List<double>(), lstDimSp, "6", scale, true, scale, 0 * scale);
        }
        #endregion

        #region 注释和表格
        public void PlotPierNote(ref Database db, out Extents2d ext, Point2d insertPoint, int scale = 1)
        {
            ext = new Extents2d(insertPoint, insertPoint);

            Point3d ptT = insertPoint.C3D();
            string text = @"注:
  1.本图尺寸除高程以米为单位外，余均以厘米为单位。
  2.图中所示保护层厚度为箍筋净保护层厚度。
  3.本图适用于" + pierPara.name + "号墩,各墩横隔板位置及布置详见“桥墩及基础一般构造”。\\P"
  + @"  4.隔板处钢筋布置参考横隔板钢筋构造布置图";
            Point3d p = insertPoint.C3D(0, 0);
            TextPloter.AddMText(db,p, ref ext, text, scale, 2.5, 90 * scale, Extensions.curFont);

        }


        #endregion

        #region 横隔板
        public void PlotPierBlockA(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "很隔板钢筋布置立面", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);


            string[] sizeM = pierPara.column.section_mid_w_ang.Split('*');
            string[] sizeBulk = pierPara.column.bulkhead_size_w.Split('*');
            string[] sizeBulkL = pierPara.column.bulkhead_size_l.Split('*');

            double mH = double.Parse(sizeM[0]);
            double mw = double.Parse(sizeM[1]);
            double bH = double.Parse(sizeBulk[0]);
            double bw = double.Parse(sizeBulk[1]);
            double bwL = double.Parse(sizeBulkL[1]);

            #region 钢筋绘制

            double lenW = Math.Round(spancwLst.Sum(), 1);
            double avg = (pierPara.column.top_w - lenW) * 0.5;
            double spaceLen = spancsLst.Sum();
            #endregion
            #region 外轮廓中部
            Point2d ptCF1 = pt.C2D(pierPara.column.top_w * 0.5);
            Point2d ptCF2 = pt.C2D(-pierPara.column.top_w * 0.5);
            Point2d ptCM1 = ptCF1.C2D();
            Point2d ptCM2 = ptCF2.C2D();
            Point2d ptCM1E = ptCF1.C2D(0, -MH);
            Point2d ptCM2E = ptCF2.C2D(0, -MH);


            PLPloter.CreateBreakLineP(db, ref ext, ptCM1.C2D(-5 * scale), ptCM2.C2D(5 * scale), scale, "H细线");

            PLPloter.AddLine(db,ptCM1, ptCM1E, ref ext, "H细线");
            PLPloter.AddLine(db,ptCM2, ptCM2E, ref ext, "H细线");

            PLPloter.CreateBreakLineP(db, ref ext, ptCM1E.C2D(-5 * scale), ptCM2E.C2D(5 * scale), scale, "H细线");

            #region 钢筋
            double len = 0;
            PLPloter.AddLine(db,ptCM1.C2D(avg), ptCM1E.C2D(avg), ref ext, "H钢筋");
            for (int m = 0; m < spancwLst.Count; m++)
            {
                len += spancwLst[m];
                if (m == spancsLst.Count - 1 || m == spancwLst.Count - spancsLst.Count - 1 || m == spancwLst.Count - 1)
                    PLPloter.AddLine(db,ptCM1.C2D(avg + len), ptCM1E.C2D(avg + len), ref ext, "H钢筋");
            }


            int numR = (int)((MH) / pierPara.pierRebarOld.middle_encryption_spacing);
            double lenH = 0;
            for (int m = 1; m <= numR; m++)
            {
                lenH += pierPara.pierRebarOld.middle_encryption_spacing;

                PLPloter.AddLine(db,ptCM1E.C2D(avg, lenH), ptCM1E.C2D(avg + spaceLen, lenH), ref ext, "H钢筋");
                PLPloter.AddLine(db,ptCM2E.C2D(-avg - spaceLen, lenH), ptCM2E.C2D(-avg, lenH), ref ext, "H钢筋");
            }


            Point2d ptICM1 = ptCF1.C2D(0, 0);
            Point2d ptICM2 = ptCF2.C2D(0, 0);
            double HB = (MH - mH * 2 - bH) * 0.5;


            List<Point2d> ptLst = new List<Point2d>();
            ptICM1 = ptCF1.C2D(- topThickness,0);
            ptICM2 = ptCF2.C2D( - topThickness, 0);
            Point2d ptICM3 = ptCF1.C2D( topThickness,  - HB);
            Point2d ptICM4 = ptCF2.C2D(- topThickness, - HB);
            Point2d ptICM5 = ptICM3.C2D(mw, -mH);
            Point2d ptICM6 = ptICM4.C2D(-mw, -mH);
            ptLst.Add(ptICM1);
            ptLst.Add(ptICM3);
            ptLst.Add(ptICM5);
            ptLst.Add(ptICM6);
            ptLst.Add(ptICM4);
            ptLst.Add(ptICM2);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);
            //Point3d ptMM = GeTools.MidPoint(ptICM3.C3D(), ptICM5.C3D());
            //DimPloter.AddMLeader(db,ptMM.C2D(), ptMM.C2D(2 * scale, 5 * scale), pierPara.column.section_mid_w_ang, ref ext, scale);
            #region 隔板
            Point2d ptICM = pt.C2D(0, - HB - mH);
            PLPloter.AddLine(db,ptICM.C2D(-bw * 0.5), ptICM.C2D(-bw * 0.5, -bH), ref ext, "H虚线");
            PLPloter.AddLine(db,ptICM.C2D(bw * 0.5), ptICM.C2D(bw * 0.5, -bH), ref ext, "H虚线");

            #endregion

            ptLst = new List<Point2d>();
            Point2d ptCMI1E = ptCF1.C2D(topThickness,- MH);
            Point2d ptCMI2E = ptCF2.C2D(- topThickness,  - MH );
            ptICM3 = ptCF1.C2D(topThickness,  - (HB + mH * 2 + bH));
            ptICM4 = ptCF2.C2D(- topThickness, - (HB + mH * 2 + bH));
            ptICM5 = ptICM3.C2D(mw, mH);
            ptICM6 = ptICM4.C2D(-mw, mH);
            ptLst.Add(ptCMI1E);
            ptLst.Add(ptICM3);
            ptLst.Add(ptICM5);
            ptLst.Add(ptICM6);
            ptLst.Add(ptICM4);
            ptLst.Add(ptCMI2E);
            PLPloter.AddPolylineByPointList(db, ptLst, ref ext, "H虚线", false);

            #endregion

            #endregion

            #region 内轮廓中部

            #endregion
        }
        public void PlotPierBlockB(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "很隔板钢筋布置侧面", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
        }
        public void PlotPierBlockPlan(ref Database db, out Extents2d ext, Point2d insertPoint, int scale)
        {
            ext = new Extents2d(insertPoint, insertPoint);
            TextPloter.AddTitle(db,insertPoint, ref ext, "很隔板钢筋布置平面", "", scale);
            Point2d pt = insertPoint.C2D(0, -3 * scale);
        }
        #endregion
    }
}
